- if (ret != 0)
- imagex_error_with_errno("Failed to stat `%s'", dir);
- if (S_ISBLK(stbuf.st_mode) || S_ISREG(stbuf.st_mode)) {
- extract_flags |= WIMLIB_EXTRACT_FLAG_NTFS;
-
- const char *dev = dir;
- printf("Making NTFS filesystem on `%s'\n", dev);
-
- char mkntfs_cmdline[sizeof("mkntfs ") + strlen(mkntfs_args) +
- sizeof(" ") + strlen(dev)];
- sprintf(mkntfs_cmdline, "mkntfs %s %s", mkntfs_args, dev);
- puts(mkntfs_cmdline);
- ret = system(mkntfs_cmdline);
- if (ret == -1) {
- imagex_error_with_errno("Failed to execute the "
- "`mkntfs' program");
- return -1;
- } else if (ret > 0) {
- imagex_error("`mkntfs' exited with failure status");
- imagex_error("Note: You can pass additional arguments "
- "to `mkntfs' using the --mkntfs-args "
- "argument");
- return -1;
- }
- sprintf(tmpdir, "/tmp/imagex-%d-ntfsmount-%s-XXXXXX",
- getpid(), dev);
- dir = mkdtemp(tmpdir);
- if (!dir) {
- imagex_error_with_errno("Failed to create "
- "temporary directory "
- "`%s'", tmpdir);
- }
- char ntfs_3g_cmdline[sizeof("ntfs-3g ") + strlen(dev) +
- sizeof(" ") + strlen(dir)];
- sprintf(ntfs_3g_cmdline, "ntfs-3g %s %s", dev, dir);
- puts(ntfs_3g_cmdline);
- ret = system(ntfs_3g_cmdline);
- if (ret == -1) {
- imagex_error_with_errno("Failed to execute the "
- "`ntfs-3g' program");
- ret = -1;
- goto out;
- } else if (ret > 0) {
- imagex_error("`ntfs-3g' exited with failure status");
- ret = -1;
+ if (ret == 0) {
+ if (S_ISBLK(stbuf.st_mode) || S_ISREG(stbuf.st_mode)) {
+ const char *ntfs_device = dir;
+ printf("Applying image %d of `%s' to NTFS filesystem on `%s'\n",
+ image, wimfile, ntfs_device);
+ ret = wimlib_apply_image_to_ntfs_volume(w, image,
+ ntfs_device,
+ extract_flags);