summaryrefslogtreecommitdiff
path: root/rpmio/rpmglob.c
diff options
context:
space:
mode:
authorMichal Domonkos <mdomonko@redhat.com>2022-06-16 15:59:51 +0200
committerPanu Matilainen <pmatilai@redhat.com>2022-08-18 12:33:00 +0300
commitecc140c42f551b8d99d89e600cb10d098d18e3e2 (patch)
treeaca2b4bf72402623da7df82bc6352dfe020353e0 /rpmio/rpmglob.c
parent06a1acdf8550d3dd1143f17fb8ff23e338aa1d9d (diff)
downloadrpm-ecc140c42f551b8d99d89e600cb10d098d18e3e2.tar.gz
Return arg count 0 from rpmGlob()
Do set *argcPtr even if the actual count is 0, rather than leaving it unchanged and thus possibly undefined in the caller. This is also consistent with how glob(3) works.
Diffstat (limited to 'rpmio/rpmglob.c')
-rw-r--r--rpmio/rpmglob.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/rpmio/rpmglob.c b/rpmio/rpmglob.c
index 04baa02eb..690e7f59f 100644
--- a/rpmio/rpmglob.c
+++ b/rpmio/rpmglob.c
@@ -117,11 +117,9 @@ int rpmGlob(const char * pattern, int * argcPtr, ARGV_t * argvPtr)
exit:
argc = argvCount(*argvPtr);
- if (argc > 0) {
- if (argcPtr)
- *argcPtr = argc;
- rc = 0;
- } else if (rc == 0)
+ if (argcPtr)
+ *argcPtr = argc;
+ if (argc == 0 && rc == 0)
rc = 1;