]> wimlib.net Git - wimlib/blobdiff - src/unix_capture.c
rename_wim_path(): Free full paths in renamed trees
[wimlib] / src / unix_capture.c
index 4f526f7dda1029815a5cfd553458b83b38dc7696..963e53dabfb388c1e33dc1a0383348ea972e8ab7 100644 (file)
@@ -1,5 +1,9 @@
 /*
- * Copyright (C) 2013 Eric Biggers
+ * unix_capture.c:  Capture a directory tree on UNIX.
+ */
+
+/*
+ * Copyright (C) 2012, 2013 Eric Biggers
  *
  * This file is part of wimlib, a library for working with WIM files.
  *
@@ -26,8 +30,9 @@
 
 #include <dirent.h>
 #include <errno.h>
-#include <unistd.h>
+#include <limits.h>
 #include <sys/stat.h>
+#include <unistd.h>
 
 static int
 unix_capture_regular_file(const char *path,
@@ -82,7 +87,7 @@ unix_capture_directory(struct wim_dentry *dir_dentry,
        if (!dir) {
                ERROR_WITH_ERRNO("Failed to open the directory `%s'",
                                 path);
-               return WIMLIB_ERR_OPEN;
+               return WIMLIB_ERR_OPENDIR;
        }
 
        /* Recurse on directory contents */
@@ -225,8 +230,9 @@ unix_build_dentry_tree_recursive(struct wim_dentry **root_ret,
                stat_fn = lstat;
 
        ret = (*stat_fn)(path, &stbuf);
-       if (ret != 0) {
+       if (ret) {
                ERROR_WITH_ERRNO("Failed to stat `%s'", path);
+               ret = WIMLIB_ERR_STAT;
                goto out;
        }
        if (!S_ISREG(stbuf.st_mode) && !S_ISDIR(stbuf.st_mode)