From c64195d14728aa82e280d022e9f7ceff71cfc6c1 Mon Sep 17 00:00:00 2001 From: Olivier Gayot Date: Wed, 20 Jun 2018 11:42:59 +0200 Subject: Fix invalid handling of glob() errors on Linux The manual of glob(3) says that the function returns 0 on successful completion. Any other integer value should be considered an error, not only negative integers. In practice, *BSD systems use negative values but Linux uses positive integers. Signed-off-by: Olivier Gayot --- src/process_runs.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/process_runs.c') diff --git a/src/process_runs.c b/src/process_runs.c index b5e8f11..da2dba1 100644 --- a/src/process_runs.c +++ b/src/process_runs.c @@ -24,7 +24,7 @@ bool process_runs(const char *path) { static glob_t globbuf; memset(pidbuf, 0, sizeof(pidbuf)); - if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) < 0) + if (glob(path, GLOB_NOCHECK | GLOB_TILDE, NULL, &globbuf) != 0) die("glob() failed\n"); if (globbuf.gl_pathc == 0) { /* No glob matches, the specified path does not contain a wildcard. */ -- cgit v1.2.3