提交 730801d9 编写于 作者: L Laine Stump 提交者: Daniel Veillard

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()
上级 cd0ef0e0
...@@ -1264,7 +1264,11 @@ int virFileCreate(const char *path, mode_t mode, ...@@ -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, ...@@ -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'"),
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册