summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--inotify-watch.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/inotify-watch.c b/inotify-watch.c
index ccedf2f..1a32786 100644
--- a/inotify-watch.c
+++ b/inotify-watch.c
@@ -3,7 +3,7 @@
*
* Watch a file or directory for changes using inotify
*
- * Copyright (c) Tobias Klauser <tklauser@distanz.ch>
+ * Copyright (c) 2008-2009 Tobias Klauser <tklauser@distanz.ch>
*
* All rights reserved.
*/
@@ -21,7 +21,7 @@ struct mask2string {
const char *desc;
};
-static struct mask2string events[] = {
+static const struct mask2string events[] = {
{ IN_ACCESS, "ACCESS" },
{ IN_MODIFY, "MODIFY" },
{ IN_ATTRIB, "ATTRIB" },
@@ -53,7 +53,8 @@ static void inotify_print_event(struct inotify_event *inev)
/* stat? */
printf("(%s) wd=%04x, cookie=%04x, len=%04x, name=\"%s\" :",
inev->mask & IN_ISDIR ? "dir" : "file",
- inev->wd, inev->cookie, inev->len, inev->name);
+ inev->wd, inev->cookie, inev->len,
+ inev->len > 0 ? inev->name : "");
for (i = 0; events[i].desc; i++)
if (inev->mask & events[i].mask)