diff options
author | Thomas Adam <thomas@xteddy.org> | 2019-12-18 08:01:23 +0000 |
---|---|---|
committer | Thomas Adam <thomas@xteddy.org> | 2019-12-18 08:01:23 +0000 |
commit | d0cd68d5e41326f50ceda58728791b08952c08d6 (patch) | |
tree | f1be8a54687bb3c25382d3bd51c5990116c5fb52 | |
parent | 4223293ed862843e15af89b4257c638dce53e1b9 (diff) | |
parent | ef54a08080ef7d721d05361bf10e27217c87590e (diff) | |
download | rtmux-d0cd68d5e41326f50ceda58728791b08952c08d6.tar.gz rtmux-d0cd68d5e41326f50ceda58728791b08952c08d6.tar.bz2 rtmux-d0cd68d5e41326f50ceda58728791b08952c08d6.zip |
Merge branch 'obsd-master'
-rw-r--r-- | cmd-source-file.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/cmd-source-file.c b/cmd-source-file.c index 0f1f79de..bdcdd222 100644 --- a/cmd-source-file.c +++ b/cmd-source-file.c @@ -129,7 +129,7 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item) char *pattern, *cwd; const char *path, *error; glob_t g; - int i; + int i, result; u_int j; cdata = xcalloc(1, sizeof *cdata); @@ -157,9 +157,15 @@ cmd_source_file_exec(struct cmd *self, struct cmdq_item *item) xasprintf(&pattern, "%s/%s", cwd, path); log_debug("%s: %s", __func__, pattern); - if (glob(pattern, 0, NULL, &g) != 0) { - error = strerror(errno); - if (errno != ENOENT || (~flags & CMD_PARSE_QUIET)) { + if ((result = glob(pattern, 0, NULL, &g)) != 0) { + if (result != GLOB_NOMATCH || + (~flags & CMD_PARSE_QUIET)) { + if (result == GLOB_NOMATCH) + error = strerror(ENOENT); + else if (result == GLOB_NOSPACE) + error = strerror(ENOMEM); + else + error = strerror(EINVAL); cmdq_error(item, "%s: %s", path, error); retval = CMD_RETURN_ERROR; } |