chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
systemctl: spawn pager only for commands that generates long output
[elogind.git]
/
src
/
path.c
diff --git
a/src/path.c
b/src/path.c
index cc8b79ad3304a64ce53b5b0b661775d3e91636ba..77de32d1d6e8442fbe9b6ed4ee5e2042861c6267 100644
(file)
--- a/
src/path.c
+++ b/
src/path.c
@@
-189,7
+189,7
@@
static int path_watch_one(Path *p, PathSpec *s) {
};
bool exists = false;
};
bool exists = false;
- char *k;
+ char *k
, *slash
;
int r;
assert(p);
int r;
assert(p);
@@
-213,15
+213,15
@@
static int path_watch_one(Path *p, PathSpec *s) {
if ((s->primary_wd = inotify_add_watch(s->inotify_fd, k, flags_table[s->type])) >= 0)
exists = true;
if ((s->primary_wd = inotify_add_watch(s->inotify_fd, k, flags_table[s->type])) >= 0)
exists = true;
-
for (;;)
{
+
do
{
int flags;
int flags;
- char *slash;
/* This assumes the path was passed through path_kill_slashes()! */
if (!(slash = strrchr(k, '/')))
break;
/* This assumes the path was passed through path_kill_slashes()! */
if (!(slash = strrchr(k, '/')))
break;
- *slash = 0;
+ /* Trim the path at the last slash. Keep the slash if it's the root dir. */
+ slash[slash == k] = 0;
flags = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB;
if (!exists)
flags = IN_DELETE_SELF|IN_MOVE_SELF|IN_ATTRIB;
if (!exists)
@@
-229,7
+229,7
@@
static int path_watch_one(Path *p, PathSpec *s) {
if (inotify_add_watch(s->inotify_fd, k, flags) >= 0)
exists = true;
if (inotify_add_watch(s->inotify_fd, k, flags) >= 0)
exists = true;
- }
+ }
while (slash != k);
return 0;
return 0;
@@
-383,6
+383,7
@@
static void path_enter_waiting(Path *p, bool initial, bool recheck) {
}
if (good) {
}
if (good) {
+ log_debug("%s got triggered.", p->meta.id);
path_enter_running(p);
return;
}
path_enter_running(p);
return;
}
@@
-485,7
+486,7
@@
static void path_fd_event(Unit *u, int fd, uint32_t events, Watch *w) {
p->state != PATH_RUNNING)
return;
p->state != PATH_RUNNING)
return;
- log_debug("inotify wakeup on %s.", u->meta.id);
+ /* log_debug("inotify wakeup on %s.", u->meta.id); */
if (events != EPOLLIN) {
log_error("Got Invalid poll event on inotify.");
if (events != EPOLLIN) {
log_error("Got Invalid poll event on inotify.");