mirror of
https://github.com/systemd/systemd-stable.git
synced 2024-12-25 23:21:33 +03:00
core/path: modernize style
This commit is contained in:
parent
4f0eedb703
commit
15f55e8092
@ -124,7 +124,7 @@ int path_spec_fd_event(PathSpec *s, uint32_t events) {
|
|||||||
int r = 0;
|
int r = 0;
|
||||||
|
|
||||||
if (events != EPOLLIN) {
|
if (events != EPOLLIN) {
|
||||||
log_error("Got Invalid poll event on inotify.");
|
log_error("Got invalid poll event on inotify.");
|
||||||
r = -EINVAL;
|
r = -EINVAL;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
@ -137,13 +137,15 @@ int path_spec_fd_event(PathSpec *s, uint32_t events) {
|
|||||||
|
|
||||||
assert(l > 0);
|
assert(l > 0);
|
||||||
|
|
||||||
if (!(buf = malloc(l))) {
|
buf = malloc(l);
|
||||||
|
if (!buf) {
|
||||||
log_error("Failed to allocate buffer: %m");
|
log_error("Failed to allocate buffer: %m");
|
||||||
r = -errno;
|
r = -errno;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((k = read(s->inotify_fd, buf, l)) < 0) {
|
k = read(s->inotify_fd, buf, l);
|
||||||
|
if (k < 0) {
|
||||||
log_error("Failed to read inotify event: %m");
|
log_error("Failed to read inotify event: %m");
|
||||||
r = -errno;
|
r = -errno;
|
||||||
goto out;
|
goto out;
|
||||||
@ -217,7 +219,8 @@ static void path_spec_mkdir(PathSpec *s, mode_t mode) {
|
|||||||
if (s->type == PATH_EXISTS || s->type == PATH_EXISTS_GLOB)
|
if (s->type == PATH_EXISTS || s->type == PATH_EXISTS_GLOB)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if ((r = mkdir_p_label(s->path, mode)) < 0)
|
r = mkdir_p_label(s->path, mode);
|
||||||
|
if (r < 0)
|
||||||
log_warning("mkdir(%s) failed: %s", s->path, strerror(-r));
|
log_warning("mkdir(%s) failed: %s", s->path, strerror(-r));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user