nixpkgs/pkgs/os-specific/linux/kvm/smbd-path.patch
Eelco Dolstra 73a050a804 * Create the smbd temporary directory properly (don't fail if it
already exists, but just try another name).  Should send this
  upstream...

svn path=/nixpkgs/trunk/; revision=12717
2008-08-26 11:16:41 +00:00

53 lines
1.6 KiB
Diff

diff -rc kvm-57-orig/qemu/vl.c kvm-57/qemu/vl.c
*** kvm-57-orig/qemu/vl.c 2007-12-18 16:57:46.000000000 +0100
--- kvm-57/qemu/vl.c 2008-08-26 13:01:39.000000000 +0200
***************
*** 3828,3838 ****
slirp_init();
}
! /* XXX: better tmp dir construction */
! snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d", getpid());
! if (mkdir(smb_dir, 0700) < 0) {
! fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
! exit(1);
}
snprintf(smb_conf, sizeof(smb_conf), "%s/%s", smb_dir, "smb.conf");
--- 3828,3840 ----
slirp_init();
}
! while (1) {
! snprintf(smb_dir, sizeof(smb_dir), "/tmp/qemu-smb.%d.%d", getpid(), random());
! if (mkdir(smb_dir, 0700) == 0) break;
! if (errno != EEXIST) {
! fprintf(stderr, "qemu: could not create samba server dir '%s'\n", smb_dir);
! exit(1);
! }
}
snprintf(smb_conf, sizeof(smb_conf), "%s/%s", smb_dir, "smb.conf");
***************
*** 3865,3872 ****
fclose(f);
atexit(smb_exit);
snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
! SMBD_COMMAND, smb_conf);
slirp_add_exec(0, smb_cmdline, 4, 139);
}
--- 3867,3877 ----
fclose(f);
atexit(smb_exit);
+ char *smbd_command = getenv("QEMU_SMBD_COMMAND");
+ if (!smbd_command) smbd_command = SMBD_COMMAND;
+
snprintf(smb_cmdline, sizeof(smb_cmdline), "%s -s %s",
! smbd_command, smb_conf);
slirp_add_exec(0, smb_cmdline, 4, 139);
}
Only in kvm-57/qemu: vl.c~