summaryrefslogtreecommitdiff
path: root/lib/util
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2011-04-21 10:04:06 -0400
committerAndreas Schneider <asn@samba.org>2011-08-10 18:14:02 +0200
commit09ad4d47f875bb3b273902f78e9882e5c4ee259f (patch)
tree2c656576539057a2c7ad465b7312ce3865f13f44 /lib/util
parent05455b459a93f620143d90fd34a28e4485fd606a (diff)
downloadsamba-09ad4d47f875bb3b273902f78e9882e5c4ee259f.tar.gz
samba-09ad4d47f875bb3b273902f78e9882e5c4ee259f.tar.bz2
samba-09ad4d47f875bb3b273902f78e9882e5c4ee259f.zip
lib-util: Make create_unlink_tmp argument optional
Use tmpdir() if no dir is provided. Signed-off-by: Andreas Schneider <asn@samba.org>
Diffstat (limited to 'lib/util')
-rw-r--r--lib/util/util.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index 4dd79266af..2d1d83036d 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -3,7 +3,7 @@
Samba utility functions
Copyright (C) Andrew Tridgell 1992-1998
Copyright (C) Jeremy Allison 2001-2002
- Copyright (C) Simo Sorce 2001
+ Copyright (C) Simo Sorce 2001-2011
Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
Copyright (C) James J Myers 2003
Copyright (C) Volker Lendecke 2010
@@ -63,6 +63,7 @@ _PUBLIC_ const char *tmpdir(void)
/**
Create a tmp file, open it and immediately unlink it.
+ If dir is NULL uses tmpdir()
Returns the file descriptor or -1 on error.
**/
int create_unlink_tmp(const char *dir)
@@ -70,6 +71,10 @@ int create_unlink_tmp(const char *dir)
char *fname;
int fd;
+ if (!dir) {
+ dir = tmpdir();
+ }
+
fname = talloc_asprintf(talloc_tos(), "%s/listenerlock_XXXXXX", dir);
if (fname == NULL) {
errno = ENOMEM;