X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=blobdiff_plain;f=src%2Fcore%2Fpath.c;h=e3defeb5abca6bc769cb67acbaf97d6b56183875;hb=c53158818d8cdaf46b3f1b5299b9bda118a1043f;hp=1d50885ed44d508e6b8f285a27e78f261f7dccbf;hpb=b30e2f4c18ad81b04e4314fd191a5d458553773c;p=elogind.git diff --git a/src/core/path.c b/src/core/path.c index 1d50885ed..e3defeb5a 100644 --- a/src/core/path.c +++ b/src/core/path.c @@ -6,16 +6,16 @@ Copyright 2010 Lennart Poettering systemd is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or + under the terms of the GNU Lesser General Public License as published by + the Free Software Foundation; either version 2.1 of the License, or (at your option) any later version. systemd is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - General Public License for more details. + Lesser General Public License for more details. - You should have received a copy of the GNU General Public License + You should have received a copy of the GNU Lesser General Public License along with systemd; If not, see . ***/ @@ -32,6 +32,7 @@ #include "dbus-path.h" #include "special.h" #include "bus-errors.h" +#include "path-util.h" static const UnitActiveState state_translation_table[_PATH_STATE_MAX] = { [PATH_DEAD] = UNIT_INACTIVE, @@ -72,14 +73,16 @@ int path_spec_watch(PathSpec *s, Unit *u) { goto fail; } - if ((s->primary_wd = inotify_add_watch(s->inotify_fd, k, flags_table[s->type])) >= 0) + s->primary_wd = inotify_add_watch(s->inotify_fd, k, flags_table[s->type]); + if (s->primary_wd >= 0) exists = true; do { int flags; /* This assumes the path was passed through path_kill_slashes()! */ - if (!(slash = strrchr(k, '/'))) + slash = strrchr(k, '/'); + if (!slash) break; /* Trim the path at the last slash. Keep the slash if it's the root dir. */ @@ -214,7 +217,7 @@ static void path_spec_mkdir(PathSpec *s, mode_t mode) { if (s->type == PATH_EXISTS || s->type == PATH_EXISTS_GLOB) return; - if ((r = mkdir_p(s->path, mode)) < 0) + if ((r = mkdir_p_label(s->path, mode)) < 0) log_warning("mkdir(%s) failed: %s", s->path, strerror(-r)); } @@ -737,7 +740,6 @@ static const char* const path_result_table[_PATH_RESULT_MAX] = { DEFINE_STRING_TABLE_LOOKUP(path_result, PathResult); const UnitVTable path_vtable = { - .suffix = ".path", .object_size = sizeof(Path), .sections = "Unit\0"