]> wimlib.net Git - wimlib/blobdiff - src/util.c
Windows native build
[wimlib] / src / util.c
index 9aad4b2cc2c962fbf1ba133d29aa098b629a2529..31b51ff41314e0f3d4d96e8435f73dc0418ae974 100644 (file)
@@ -3,7 +3,7 @@
  */
 
 /*
- * Copyright (C) 2012 Eric Biggers
+ * Copyright (C) 2012, 2013 Eric Biggers
  *
  * This file is part of wimlib, a library for working with WIM files.
  *
  * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
+#include "config.h"
+
+#define MINGW_HAS_SECURE_API
+
 #undef _GNU_SOURCE
 /* Make sure the POSIX-compatible strerror_r() is declared, rather than the GNU
  * version, which has a different return type. */
 
 #include <unistd.h> /* for getpid() */
 
+/* Windoze compatibility */
+#ifdef __WIN32__
+#  define strerror_r(errnum, buf, bufsize) strerror_s(buf, bufsize, errnum)
+#endif
+
 /* True if wimlib is to print an informational message when an error occurs.
  * This can be turned off by calling wimlib_set_print_errors(false). */
 #ifdef ENABLE_ERROR_MESSAGES
@@ -54,12 +63,13 @@ static void wimlib_vmsg(const char *tag, const char *format,
                vfprintf(stderr, format, va);
                if (perror && errno_save != 0) {
                        char buf[50];
-                       int res = strerror_r(errno_save, buf, sizeof(buf));
+                       int res;
+                       res = strerror_r(errno_save, buf, sizeof(buf));
                        if (res) {
                                snprintf(buf, sizeof(buf),
                                         "unknown error (errno=%d)", errno_save);
                        }
-                       fputs(buf, stderr);
+                       fprintf(stderr, ": %s", buf);
                }
                putc('\n', stderr);
                errno = errno_save;
@@ -137,6 +147,9 @@ static const char *error_strings[] = {
        [WIMLIB_ERR_FUSERMOUNT]
                = "Could not execute the `fusermount' program, or it exited "
                        "with a failure status",
+       [WIMLIB_ERR_ICONV_NOT_AVAILABLE]
+               = "The iconv() function does not seem to work. "
+                 "Maybe check to make sure the directory /usr/lib/gconv exists",
        [WIMLIB_ERR_IMAGE_COUNT]
                = "Inconsistent image count among the metadata "
                        "resources, the WIM header, and/or the XML data",
@@ -162,17 +175,18 @@ static const char *error_strings[] = {
                = "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_OVERLAY]
+               = "Conflicting files in overlay when creating a WIM image",
        [WIMLIB_ERR_INVALID_PARAM]
                = "An invalid parameter was given",
        [WIMLIB_ERR_INVALID_PART_NUMBER]
                = "The part number or total parts of the WIM is invalid",
        [WIMLIB_ERR_INVALID_RESOURCE_HASH]
                = "The SHA1 message digest of a WIM resource did not match the expected value",
-       [WIMLIB_ERR_ICONV_NOT_AVAILABLE]
-               = "The iconv() function does not seem to work. "
-                 "Maybe check to make sure the directory /usr/lib/gconv exists",
        [WIMLIB_ERR_INVALID_RESOURCE_SIZE]
                = "A resource entry in the WIM has an invalid size",
+       [WIMLIB_ERR_INVALID_SECURITY_DATA]
+               = "The table of security descriptors in the WIM is invalid",
        [WIMLIB_ERR_INVALID_UNMOUNT_MESSAGE]
                = "The version of wimlib that has mounted a WIM image is incompatible with the "
                  "version being used to unmount it",
@@ -223,6 +237,8 @@ static const char *error_strings[] = {
                = "The WIM is part of a split WIM, which is not supported for this operation",
        [WIMLIB_ERR_STAT]
                = "Could not read the metadata for a file or directory",
+       [WIMLIB_ERR_TIMEOUT]
+               = "Timed out while waiting for a message to arrive from another process",
        [WIMLIB_ERR_UNKNOWN_VERSION]
                = "The WIM file is marked with an unknown version number",
        [WIMLIB_ERR_UNSUPPORTED]