if (!(tmp = g_strdup_printf("%s/qemu.screendump.XXXXXX", cfg->cacheDir)))
goto endjob;
- if ((tmp_fd = mkostemp(tmp, O_CLOEXEC)) == -1) {
- virReportSystemError(errno, _("mkostemp(\"%s\") failed"), tmp);
+ if ((tmp_fd = g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) == -1) {
+ virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"), tmp);
goto endjob;
}
unlink_tmp = true;
goto endjob;
/* Create a temporary filename. */
- if ((fd = mkostemp(tmp, O_CLOEXEC)) == -1) {
+ if ((fd = g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) == -1) {
virReportSystemError(errno,
- _("mkostemp(\"%s\") failed"), tmp);
+ _("g_mkstemp(\"%s\") failed"), tmp);
goto endjob;
}
*
* Generate a name for a temporary file using the driver stateDir
* as a path, the pool name, and the volume name to be used as input
- * for a mkostemp
+ * for mkstemp
*
* Returns a string pointer on success, NULL on failure
*/
if (!(secretPath = virStoragePoolObjBuildTempFilePath(pool, vol)))
goto cleanup;
- if ((fd = mkostemp(secretPath, O_CLOEXEC)) < 0) {
+ if ((fd = g_mkstemp_full(secretPath, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0) {
virReportSystemError(errno, "%s",
_("failed to open secret file for write"));
goto error;
* and pass an FD to the journal
*/
- /* NB: mkostemp is not declared async signal safe by
- * POSIX, but this is Linux only code and the GLibc
- * impl is safe enough, only using open() and inline
- * asm to read a timestamp (falling back to gettimeofday
- * on some arches
- */
- if ((buffd = mkostemp(path, O_CLOEXEC|O_RDWR)) < 0)
+ if ((buffd = g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0)
return;
if (unlink(path) < 0)
tmp = g_strdup_printf("%s/vbox.screendump.XXXXXX", cacheDir);
- if ((tmp_fd = mkostemp(tmp, O_CLOEXEC)) == -1) {
- virReportSystemError(errno, _("mkostemp(\"%s\") failed"), tmp);
+ if ((tmp_fd = g_mkstemp_full(tmp, O_CLOEXEC, S_IRUSR | S_IWUSR)) == -1) {
+ virReportSystemError(errno, _("g_mkstemp(\"%s\") failed"), tmp);
VIR_FREE(tmp);
VBOX_RELEASE(machine);
return NULL;
off_t len = 0;
size_t i;
- if ((fd = mkostemp(path, O_CLOEXEC|O_RDWR)) < 0)
+ if ((fd = g_mkstemp_full(path, O_CLOEXEC, S_IRUSR | S_IWUSR)) < 0)
goto error;
if (unlink(path) < 0)
tmpdir = getenv("TMPDIR");
if (!tmpdir) tmpdir = "/tmp";
ret = g_strdup_printf("%s/virshXXXXXX.xml", tmpdir);
- fd = mkostemps(ret, 4, O_CLOEXEC);
+ fd = g_mkstemp_full(ret, O_CLOEXEC, S_IRUSR | S_IWUSR);
if (fd == -1) {
- vshError(ctl, _("mkostemps: failed to create temporary file: %s"),
+ vshError(ctl, _("g_mkstemp_full: failed to create temporary file: %s"),
virStrerror(errno, ebuf, sizeof(ebuf)));
VIR_FREE(ret);
return NULL;