From 7b110ed2bc6294d9253bc57825e0005f35b9226c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20D=C3=B8rum?= Date: Sat, 25 May 2019 23:33:05 +0200 Subject: [PATCH] Treat anything that's not a directory as a file --- i3lock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/i3lock.c b/i3lock.c index e855ad9..a8638ad 100644 --- a/i3lock.c +++ b/i3lock.c @@ -262,10 +262,10 @@ bool bar_reversed = false; /* * Checks if the given path leads to an actual file or something else, e.g. a directory */ -int is_regular_file(const char *path) { +int is_directory(const char *path) { struct stat path_stat; stat(path, &path_stat); - return S_ISREG(path_stat.st_mode); + return !S_ISDIR(path_stat.st_mode); } /* @@ -1956,7 +1956,7 @@ int main(int argc, char *argv[]) { init_colors_once(); if (image_path != NULL) { - if (is_regular_file(image_path)) { + if (!is_directory(image_path)) { img = load_image(image_path); } else { /* Path to a directory is provided -> use slideshow mode */