X-Git-Url: https://wimlib.net/git/?p=wimlib;a=blobdiff_plain;f=src%2Futil.c;h=fa7ac5a069f4ef197992dfc5f0ba28cfef5675c9;hp=b2d26256a5c60d82f78747aa12db9ee3e456dfb0;hb=d7fe0bb80dc0f7845eee30556c98b5f94eed7d06;hpb=dff049d44d86598d82bf78d3fdcfedc28db83018 diff --git a/src/util.c b/src/util.c index b2d26256..fa7ac5a0 100644 --- a/src/util.c +++ b/src/util.c @@ -67,6 +67,7 @@ void wimlib_error_with_errno(const char *format, ...) va_start(va, format); errno_save = errno; + fflush(stdout); fputs("[ERROR] ", stderr); vfprintf(stderr, format, va); fprintf(stderr, ": %s\n", strerror(errno_save)); @@ -83,6 +84,7 @@ void wimlib_warning(const char *format, ...) va_start(va, format); errno_save = errno; + fflush(stdout); fputs("[WARNING] ", stderr); vfprintf(stderr, format, va); putc('\n', stderr); @@ -127,6 +129,8 @@ static const char *error_strings[] = { = "Tried to add an image with a name that is already in use", [WIMLIB_ERR_INTEGRITY] = "The WIM failed an integrity check", + [WIMLIB_ERR_INVALID_CAPTURE_CONFIG] + = "The capture configuration string was invalid", [WIMLIB_ERR_INVALID_CHUNK_SIZE] = "The WIM is compressed but does not have a chunk " "size of 32768", @@ -427,8 +431,13 @@ const char *path_basename(const char *path) p--; /* Trailing slashes. */ - while ((p != path - 1) && *p == '/') + while (1) { + if (p == path - 1) + return ""; + if (*p != '/') + break; p--; + } while ((p != path - 1) && *p != '/') p--;