I'm offering this patch which ensures that the paths of tempfiles are 
created with the appropriate separator for the machine.

J'


-- 
PGP Public key ID: 1024D/2DE827B3 
fingerprint = 8797 A26D 0854 2EAB 0285  A290 8A67 719C 2DE8 27B3
See http://keys.gnupg.net or any PGP keyserver for public key.

From 7597c055a47a06a10f8f8d4e64cf2fd8131df7fe Mon Sep 17 00:00:00 2001
From: John Darrington <j...@darrington.wattle.id.au>
Date: Wed, 6 Jun 2012 20:46:45 +0200
Subject: [PATCH] Use the macro DIRECTORY_SEPARATOR instead of a literal / when building pathnames

---
 lib/tempname.c |    4 +++-
 lib/tmpdir.c   |    4 +++-
 2 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/lib/tempname.c b/lib/tempname.c
index de0474d..f184960 100644
--- a/lib/tempname.c
+++ b/lib/tempname.c
@@ -22,6 +22,8 @@
 # include "tempname.h"
 #endif
 
+#include <dirname.h>
+
 #include <sys/types.h>
 #include <assert.h>
 
@@ -170,7 +172,7 @@ __path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
       return -1;
     }
 
-  sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+  sprintf (tmpl, "%.*s%c%.*sXXXXXX", (int) dlen, dir, DIRECTORY_SEPARATOR, (int) plen, pfx);
   return 0;
 }
 #endif /* _LIBC */
diff --git a/lib/tmpdir.c b/lib/tmpdir.c
index 6ae7c42..14117ac 100644
--- a/lib/tmpdir.c
+++ b/lib/tmpdir.c
@@ -22,6 +22,8 @@
 /* Specification.  */
 #include "tmpdir.h"
 
+#include <dirname.h>
+
 #include <stdbool.h>
 #include <stdlib.h>
 #include <string.h>
@@ -152,6 +154,6 @@ path_search (char *tmpl, size_t tmpl_len, const char *dir, const char *pfx,
       return -1;
     }
 
-  sprintf (tmpl, "%.*s/%.*sXXXXXX", (int) dlen, dir, (int) plen, pfx);
+  sprintf (tmpl, "%.*s%c%.*sXXXXXX", (int) dlen, dir, DIRECTORY_SEPARATOR, (int) plen, pfx);
   return 0;
 }
-- 
1.7.2.5

Attachment: signature.asc
Description: Digital signature

Reply via email to