From: Jinhyung Jo Date: Mon, 25 Sep 2017 08:36:20 +0000 (+0900) Subject: service: fix a bug in crash report service X-Git-Tag: submit/tizen_4.0/20170927.013830^2~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a81bccd7f0fc6fe64a991455a7d72810746112ac;p=sdk%2Ftarget%2Fsdbd.git service: fix a bug in crash report service Added to watch for the move event. Change-Id: I1e2a8e39217f25d19bc9c84c3dab663311fb5523 Signed-off-by: Jinhyung Jo --- diff --git a/src/services.c b/src/services.c index ea991c2..2976230 100644 --- a/src/services.c +++ b/src/services.c @@ -227,7 +227,7 @@ void inoti_service(int fd, void *arg) 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); @@ -259,6 +259,18 @@ void inoti_service(int fd, void *arg) 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