Only open regular files; fixes issue #252
This commit is contained in:
parent
891f389f0e
commit
878d97068c
2
Makefile
2
Makefile
@ -1,4 +1,4 @@
|
|||||||
VERSION := git-20160928
|
VERSION := git-20161020
|
||||||
|
|
||||||
PREFIX := /usr/local
|
PREFIX := /usr/local
|
||||||
MANPREFIX := $(PREFIX)/share/man
|
MANPREFIX := $(PREFIX)/share/man
|
||||||
|
5
image.c
5
image.c
@ -19,6 +19,7 @@
|
|||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
#include <sys/stat.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
@ -296,8 +297,10 @@ bool img_load_gif(img_t *img, const fileinfo_t *file)
|
|||||||
bool img_load(img_t *img, const fileinfo_t *file)
|
bool img_load(img_t *img, const fileinfo_t *file)
|
||||||
{
|
{
|
||||||
const char *fmt;
|
const char *fmt;
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
if (access(file->path, R_OK) < 0 ||
|
if (access(file->path, R_OK) == -1 ||
|
||||||
|
stat(file->path, &st) == -1 || !S_ISREG(st.st_mode) ||
|
||||||
(img->im = imlib_load_image(file->path)) == NULL)
|
(img->im = imlib_load_image(file->path)) == NULL)
|
||||||
{
|
{
|
||||||
if (file->flags & FF_WARN)
|
if (file->flags & FF_WARN)
|
||||||
|
16
thumbs.c
16
thumbs.c
@ -239,6 +239,7 @@ bool tns_load(tns_t *tns, int n, bool force, bool cache_only)
|
|||||||
float zw, zh;
|
float zw, zh;
|
||||||
thumb_t *t;
|
thumb_t *t;
|
||||||
fileinfo_t *file;
|
fileinfo_t *file;
|
||||||
|
struct stat st;
|
||||||
Imlib_Image im = NULL;
|
Imlib_Image im = NULL;
|
||||||
|
|
||||||
if (n < 0 || n >= *tns->cnt)
|
if (n < 0 || n >= *tns->cnt)
|
||||||
@ -330,12 +331,15 @@ bool tns_load(tns_t *tns, int n, bool force, bool cache_only)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (im == NULL && (access(file->path, R_OK) < 0 ||
|
if (im == NULL) {
|
||||||
(im = imlib_load_image(file->path)) == NULL))
|
if (access(file->path, R_OK) == -1 ||
|
||||||
{
|
stat(file->path, &st) == -1 || !S_ISREG(st.st_mode) ||
|
||||||
if (file->flags & FF_WARN)
|
(im = imlib_load_image(file->path)) == NULL)
|
||||||
error(0, 0, "%s: Error opening image", file->name);
|
{
|
||||||
return false;
|
if (file->flags & FF_WARN)
|
||||||
|
error(0, 0, "%s: Error opening image", file->name);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
imlib_context_set_image(im);
|
imlib_context_set_image(im);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user