* qemu-kvm: honour $TMPDIR for the qemu-smb temporary directory. This

ensures that Nix cleans up the qemu-smb directory after a VM test
  run (which prevents failures like this one:
  http://hydra.nixos.org/build/275355/nixlog/31/raw).

svn path=/nixpkgs/trunk/; revision=19747
This commit is contained in:
Eelco Dolstra 2010-02-01 15:12:49 +00:00
parent d5219beafc
commit f719b5268e
2 changed files with 26 additions and 1 deletions

View file

@ -10,7 +10,7 @@ stdenv.mkDerivation rec {
sha256 = "0nmg9dp3h040dkxq5vv4i7ip76v98rnhzqwy4pd88zznawc2k9l2";
};
patches = [ ./unix-domain.patch ];
patches = [ ./unix-domain.patch ./smb-tmpdir.patch ];
buildInputs = [zlib SDL alsaLib pkgconfig pciutils];

View file

@ -0,0 +1,25 @@
Honour $TMPDIR for the qemu-smb temporary directory.
diff -rc -x '*~' qemu-kvm-0.12.2-orig/net/slirp.c qemu-kvm-0.12.2/net/slirp.c
*** qemu-kvm-0.12.2-orig/net/slirp.c 2010-01-18 19:48:25.000000000 +0100
--- qemu-kvm-0.12.2/net/slirp.c 2010-02-01 15:56:43.000000000 +0100
***************
*** 480,486 ****
char smb_cmdline[128];
FILE *f;
! snprintf(s->smb_dir, sizeof(s->smb_dir), "/tmp/qemu-smb.%ld-%d",
(long)getpid(), instance++);
if (mkdir(s->smb_dir, 0700) < 0) {
qemu_error("could not create samba server dir '%s'\n", s->smb_dir);
--- 480,489 ----
char smb_cmdline[128];
FILE *f;
! char *tmpdir = getenv("TMPDIR");
!
! snprintf(s->smb_dir, sizeof(s->smb_dir), "%s/qemu-smb.%ld-%d",
! tmpdir ? tmpdir : "/tmp",
(long)getpid(), instance++);
if (mkdir(s->smb_dir, 0700) < 0) {
qemu_error("could not create samba server dir '%s'\n", s->smb_dir);