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);
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;
/* 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;
}