]> wimlib.net Git - wimlib/blobdiff - src/split.c
Add memdup() function
[wimlib] / src / split.c
index 8b67079e0f507316eba1b91f40ab0aefac143a1a..05a7beebd9585b2d4141b26b4e284c881103feea 100644 (file)
  * along with wimlib; if not, see http://www.gnu.org/licenses/.
  */
 
-#include "wimlib_internal.h"
-#include "lookup_table.h"
-#include "xml.h"
-#include "buffer_io.h"
-#include <unistd.h>
-#include <fcntl.h>
+#ifdef HAVE_CONFIG_H
+#  include "config.h"
+#endif
+
+#include "wimlib.h"
+#include "wimlib/buffer_io.h"
+#include "wimlib/error.h"
+#include "wimlib/file_io.h"
+#include "wimlib/lookup_table.h"
+#include "wimlib/metadata.h"
+#include "wimlib/types.h"
+#include "wimlib/write.h"
+#include "wimlib/list.h"
+
+#include <fcntl.h> /* for open() */
+#include <unistd.h> /* for close() */
 
 struct split_args {
        WIMStruct *w;
@@ -60,9 +70,9 @@ finish_swm(WIMStruct *w, struct list_head *lte_list,
 }
 
 static int
-copy_resource_to_swm(struct wim_lookup_table_entry *lte, void *__args)
+copy_resource_to_swm(struct wim_lookup_table_entry *lte, void *_args)
 {
-       struct split_args *args = (struct split_args*)__args;
+       struct split_args *args = (struct split_args*)_args;
        WIMStruct *w = args->w;
        int ret;
 
@@ -226,7 +236,7 @@ wimlib_split(WIMStruct *w, const tchar *swm_name,
                }
 
                part_fd = topen(part_name, O_WRONLY | O_BINARY);
-               if (part_fd == INVALID_FILEDES) {
+               if (part_fd == -1) {
                        ERROR_WITH_ERRNO("Failed to open `%"TS"'", part_name);
                        ret = WIMLIB_ERR_OPEN;
                        goto out;