summaryrefslogtreecommitdiff
path: root/source3/lib/smbrun.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-04-13 19:12:06 +0000
committerJeremy Allison <jra@samba.org>2001-04-13 19:12:06 +0000
commit2ef68c7e92d4661664f0410509f7cb551e74a198 (patch)
tree7a3ea392bf8664e28ad46b2edb1afd750335ccc9 /source3/lib/smbrun.c
parent14748b0bf56239695cadb6aa40d9095259ebb6e2 (diff)
downloadsamba-2ef68c7e92d4661664f0410509f7cb551e74a198.tar.gz
samba-2ef68c7e92d4661664f0410509f7cb551e74a198.tar.bz2
samba-2ef68c7e92d4661664f0410509f7cb551e74a198.zip
Merge of Andrew's changes in 2.2.
Jeremy. (This used to be commit fc76681812b1469208ad6c8847afdfc68bc6db49)
Diffstat (limited to 'source3/lib/smbrun.c')
-rw-r--r--source3/lib/smbrun.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/source3/lib/smbrun.c b/source3/lib/smbrun.c
index a543ff5eee..62378503e0 100644
--- a/source3/lib/smbrun.c
+++ b/source3/lib/smbrun.c
@@ -30,14 +30,12 @@ extern int DEBUGLEVEL;
This is a utility function of smbrun().
****************************************************************************/
-static BOOL setup_out_fd(char *template)
+static int setup_out_fd(void)
{
int fd;
pstring path;
- pstrcpy( path, template);
- pstrcat( path, generate_random_str(17));
- pstrcat( path, ".XXXXXX");
+ slprintf(path, sizeof(path)-1, "%s/smb.XXXXXX", tmpdir());
/* now create the file */
fd = smb_mkstemp(path);
@@ -60,7 +58,7 @@ run a command being careful about uid/gid handling and putting the output in
outfd (or discard it if outfd is NULL).
****************************************************************************/
-int smbrun(char *cmd, int *outfd, char *template)
+int smbrun(char *cmd, int *outfd)
{
pid_t pid;
uid_t uid = current_user.uid;
@@ -73,7 +71,7 @@ int smbrun(char *cmd, int *outfd, char *template)
/* point our stdout at the file we want output to go into */
- if (outfd && ((*outfd = setup_out_fd(template)) == -1)) {
+ if (outfd && ((*outfd = setup_out_fd()) == -1)) {
return -1;
}