mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-12-24 14:45:24 +00:00
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:
parent
cd0ef0e09b
commit
730801d955
@ -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'"),
|
||||||
|
Loading…
Reference in New Issue
Block a user