return;
}
- wd = inotify_add_watch( ifd, CS_PATH, IN_CREATE);
+ wd = inotify_add_watch(ifd, CS_PATH, IN_CREATE | IN_MOVE);
if ( wd < 0 ) {
D("inotify_add_watch failed (errno :%d)\n", errno);
sdb_close(ifd);
D( "asprintf was failed\n" );
}
}
+ } else if (event->mask & IN_MOVE) {
+ if (!(event->mask & IN_ISDIR)) {
+ char *cspath = NULL;
+ int len = asprintf(&cspath, "%s/%s", CS_PATH, event->name);
+ if (len >= 0) {
+ D("The file %s was moved.\n", cspath);
+ writex(fd, cspath, len);
+ free(cspath);
+ } else {
+ D("asprintf was failed\n");
+ }
+ }
}
}
if (i + EVENT_SIZE + event->len < event->len) { // in case of integer overflow