提交 4e6ee877 编写于 作者: E Erik Skultety

virfile: virDirCreate: Insert blank lines to assure slightly better readability

上级 e9478d9a
...@@ -2376,6 +2376,7 @@ virDirCreate(const char *path, ...@@ -2376,6 +2376,7 @@ virDirCreate(const char *path,
if (pid) { /* parent */ if (pid) { /* parent */
/* wait for child to complete, and retrieve its exit code */ /* wait for child to complete, and retrieve its exit code */
VIR_FREE(groups); VIR_FREE(groups);
while ((waitret = waitpid(pid, &status, 0)) == -1 && errno == EINTR); while ((waitret = waitpid(pid, &status, 0)) == -1 && errno == EINTR);
if (waitret == -1) { if (waitret == -1) {
ret = -errno; ret = -errno;
...@@ -2416,6 +2417,7 @@ virDirCreate(const char *path, ...@@ -2416,6 +2417,7 @@ virDirCreate(const char *path,
ret = errno; ret = errno;
goto childerror; goto childerror;
} }
if (mkdir(path, mode) < 0) { if (mkdir(path, mode) < 0) {
ret = errno; ret = errno;
if (ret != EACCES) { if (ret != EACCES) {
...@@ -2425,6 +2427,7 @@ virDirCreate(const char *path, ...@@ -2425,6 +2427,7 @@ virDirCreate(const char *path,
} }
goto childerror; goto childerror;
} }
/* check if group was set properly by creating after /* check if group was set properly by creating after
* setgid. If not, try doing it with chown */ * setgid. If not, try doing it with chown */
if (stat(path, &st) == -1) { if (stat(path, &st) == -1) {
...@@ -2433,6 +2436,7 @@ virDirCreate(const char *path, ...@@ -2433,6 +2436,7 @@ virDirCreate(const char *path,
_("stat of '%s' failed"), path); _("stat of '%s' failed"), path);
goto childerror; goto childerror;
} }
if ((st.st_gid != gid) && (chown(path, (uid_t) -1, gid) < 0)) { if ((st.st_gid != gid) && (chown(path, (uid_t) -1, gid) < 0)) {
ret = errno; ret = errno;
virReportSystemError(errno, virReportSystemError(errno,
...@@ -2440,12 +2444,14 @@ virDirCreate(const char *path, ...@@ -2440,12 +2444,14 @@ virDirCreate(const char *path,
path, (unsigned int) gid); path, (unsigned int) gid);
goto childerror; goto childerror;
} }
if (mode != (mode_t) -1 && chmod(path, mode) < 0) { if (mode != (mode_t) -1 && chmod(path, mode) < 0) {
virReportSystemError(errno, virReportSystemError(errno,
_("cannot set mode of '%s' to %04o"), _("cannot set mode of '%s' to %04o"),
path, mode); path, mode);
goto childerror; goto childerror;
} }
childerror: childerror:
if ((ret & 0xff) != ret) { if ((ret & 0xff) != ret) {
VIR_WARN("unable to pass desired return value %d", ret); VIR_WARN("unable to pass desired return value %d", ret);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册