summary refs log tree commit diff
path: root/pkgs/os-specific/linux/kvm
diff options
context:
space:
mode:
authorEelco Dolstra <eelco.dolstra@logicblox.com>2008-08-26 11:16:41 +0000
committerEelco Dolstra <eelco.dolstra@logicblox.com>2008-08-26 11:16:41 +0000
commit73a050a80425483747977e63bdb68a390c52d5cd (patch)
tree5ca9d08d87042862b6265b1e6835025614e83c4f /pkgs/os-specific/linux/kvm
parentbb45f8360ff1c9cb73edb615e1728b83a54b32ab (diff)
* 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
Diffstat (limited to 'pkgs/os-specific/linux/kvm')
-rw-r--r--pkgs/os-specific/linux/kvm/smbd-path.patch31
1 files changed, 29 insertions, 2 deletions
diff --git a/pkgs/os-specific/linux/kvm/smbd-path.patch b/pkgs/os-specific/linux/kvm/smbd-path.patch
index 45e9a4bacced3..8535c28811dd9 100644
--- a/pkgs/os-specific/linux/kvm/smbd-path.patch
+++ b/pkgs/os-specific/linux/kvm/smbd-path.patch
@@ -1,6 +1,33 @@
 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-03-11 16:17:26.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);
@@ -11,7 +38,7 @@ diff -rc kvm-57-orig/qemu/vl.c kvm-57/qemu/vl.c
   
       slirp_add_exec(0, smb_cmdline, 4, 139);
   }
---- 3865,3875 ----
+--- 3867,3877 ----
       fclose(f);
       atexit(smb_exit);