]> wimlib.net Git - wimlib/blobdiff - src/util.c
Print names of dentries in split link groups when in debug mode
[wimlib] / src / util.c
index e5b0d9e7ad586728387a06dd18f7c1f5515707f6..fa7ac5a069f4ef197992dfc5f0ba28cfef5675c9 100644 (file)
@@ -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",
@@ -141,6 +145,8 @@ static const char *error_strings[] = {
                = "Tried to select an image that does not exist in the WIM",
        [WIMLIB_ERR_INVALID_INTEGRITY_TABLE] 
                = "The WIM's integrity table is invalid",
+       [WIMLIB_ERR_INVALID_LOOKUP_TABLE_ENTRY]
+               = "An entry in the WIM's lookup table is invalid",
        [WIMLIB_ERR_INVALID_PARAM] 
                = "An invalid parameter was given",
        [WIMLIB_ERR_INVALID_RESOURCE_HASH]
@@ -163,8 +169,6 @@ static const char *error_strings[] = {
                        "identify a WIM file",
        [WIMLIB_ERR_NO_FILENAME] 
                = "The WIM is not identified with a filename",
-       [WIMLIB_ERR_NOT_ROOT]
-               = "Root privileges are required for this operation",
        [WIMLIB_ERR_NTFS_3G]
                = "NTFS-3g encountered an error (check errno)",
        [WIMLIB_ERR_OPEN] 
@@ -265,7 +269,7 @@ static iconv_t cd_utf16_to_utf8 = (iconv_t)(-1);
 /* Converts a string in the UTF-16 encoding to a newly allocated string in the
  * UTF-8 encoding.  */
 char *utf16_to_utf8(const char *utf16_str, size_t utf16_len,
-                               size_t *utf8_len_ret)
+                   size_t *utf8_len_ret)
 {
        if (cd_utf16_to_utf8 == (iconv_t)(-1)) {
                cd_utf16_to_utf8 = iconv_open("UTF-8", "UTF-16LE");
@@ -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--;