diff options
author | Gunnar Mills <gmills@us.ibm.com> | 2017-04-27 16:13:17 -0500 |
---|---|---|
committer | Gunnar Mills <gmills@us.ibm.com> | 2017-04-27 16:15:43 -0500 |
commit | 368cfcbb4755f6b78f6f0c5976aece4ce823f4ec (patch) | |
tree | c4118843a9075837716761ddd66373efc30d1bb4 /watch.cpp | |
parent | 4973943157c2c1258e522ed183044dbc9e623863 (diff) | |
download | phosphor-bmc-code-mgmt-368cfcbb4755f6b78f6f0c5976aece4ce823f4ec.tar.gz phosphor-bmc-code-mgmt-368cfcbb4755f6b78f6f0c5976aece4ce823f4ec.zip |
Change inotify to look at IN_CLOSE_WRITE flag
The inotify is triggering before the image is done
downloading. This leads to a corrupted tar.
Look at the IN_CLOSE_WRITE flag instead.
Change-Id: Ib9d3f97ae3c48960a0bdf84250a66d1f8254a7f5
Signed-off-by: Gunnar Mills <gmills@us.ibm.com>
Diffstat (limited to 'watch.cpp')
-rw-r--r-- | watch.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -29,7 +29,7 @@ Watch::Watch(sd_event* loop) "inotify_init1 failed, errno="s + std::strerror(error)); } - wd = inotify_add_watch(fd, IMG_UPLOAD_DIR, IN_CREATE); + wd = inotify_add_watch(fd, IMG_UPLOAD_DIR, IN_CLOSE_WRITE); if (-1 == wd) { auto error = errno; @@ -84,7 +84,7 @@ int Watch::callback(sd_event_source* s, while (offset < bytes) { auto event = reinterpret_cast<inotify_event*>(&buffer[offset]); - if ((event->mask & IN_CREATE) && !(event->mask & IN_ISDIR)) + if ((event->mask & IN_CLOSE_WRITE) && !(event->mask & IN_ISDIR)) { // TODO: openbmc/openbmc#1352 - invoke method (which takes uploaded // filepath) to construct software version d-bus objects. |