view src/lib/safe-mkstemp.h @ 19604:c996bc091c6b

master: Do not close stdout if going foreground This lets one to use /dev/stdout for logging. Mainly useful for testing purposes where we can generate log output to stdout and use tee to write it to a file for later examination.
author Aki Tuomi <aki.tuomi@dovecot.fi>
date Mon, 18 Jan 2016 15:50:23 +0200
parents b373de4973cd
children
line wrap: on
line source

#ifndef SAFE_MKSTEMP_H
#define SAFE_MKSTEMP_H

/* Create a new file with a given prefix. The string is updated to contain the
   created filename. uid and gid can be (uid_t)-1 and (gid_t)-1 to use the
   defaults. */
int safe_mkstemp(string_t *prefix, mode_t mode, uid_t uid, gid_t gid);
int safe_mkstemp_group(string_t *prefix, mode_t mode,
		       gid_t gid, const char *gid_origin);
/* Append host and PID to the prefix. */
int safe_mkstemp_hostpid(string_t *prefix, mode_t mode, uid_t uid, gid_t gid);
int safe_mkstemp_hostpid_group(string_t *prefix, mode_t mode,
			       gid_t gid, const char *gid_origin);

#endif