From d927517327453a5cd683df1c51cf4e3fe2eec580 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Sat, 6 Jul 2019 08:37:47 +0200 Subject: [PATCH] xbps-fbulk: do not make assert() change program behaviour. ... otherwise if NDEBUG is set chdir() is skipped completely. --- bin/xbps-fbulk/main.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bin/xbps-fbulk/main.c b/bin/xbps-fbulk/main.c index d89aacfe..2faaba1a 100644 --- a/bin/xbps-fbulk/main.c +++ b/bin/xbps-fbulk/main.c @@ -656,7 +656,10 @@ main(int argc, char **argv) * Process all directories in void-packages/srcpkgs, excluding symlinks * (subpackages). */ - assert(chdir(rpath) == 0); + if (chdir(rpath) == -1) { + fprintf(stderr, "ERROR: failed to chdir to %s: %s\n", rpath, strerror(errno)); + exit(EXIT_FAILURE); + } if ((dir = opendir(rpath)) != NULL) { while ((den = readdir(dir)) != NULL) {