Another fork() log locking cleanup in file creation

Similar fix as previous one but for fork() usage when creating
a file or directory

* src/util/util.c: virLogLock() and virLogUnlock() around fork()
  in virFileCreate() and virDirCreateSimple()
This commit is contained in:
Laine Stump 2010-02-03 17:19:39 +01:00 committed by Daniel Veillard
parent cd0ef0e09b
commit 730801d955

View File

@ -1264,7 +1264,11 @@ int virFileCreate(const char *path, mode_t mode,
* following dance avoids problems caused by root-squashing * following dance avoids problems caused by root-squashing
* NFS servers. */ * NFS servers. */
if ((pid = fork()) < 0) { virLogLock();
pid = fork();
virLogUnlock();
if (pid < 0) {
ret = errno; ret = errno;
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("cannot fork o create file '%s'"), path); _("cannot fork o create file '%s'"), path);
@ -1370,7 +1374,11 @@ int virDirCreate(const char *path, mode_t mode,
return virDirCreateSimple(path, mode, uid, gid, flags); return virDirCreateSimple(path, mode, uid, gid, flags);
} }
if ((pid = fork()) < 0) { virLogLock();
pid = fork();
virLogUnlock();
if (pid < 0) {
ret = errno; ret = errno;
virReportSystemError(NULL, errno, virReportSystemError(NULL, errno,
_("cannot fork to create directory '%s'"), _("cannot fork to create directory '%s'"),