mtp

Merge lp:~cyphermox/mtp/recursive-delete-fix into lp:mtp

Proposed by Mathieu Trudel-Lapierre on 2015-01-26
Status: Merged
Approved by: Ricardo Salveti on 2015-01-26
Approved revision: 62
Merged at revision: 62
Proposed branch: lp:~cyphermox/mtp/recursive-delete-fix
Merge into: lp:mtp
Diff against target: 25 lines (+7/-1)
1 file modified
server/UbuntuMtpDatabase.h (+7/-1)
To merge this branch: bzr merge lp:~cyphermox/mtp/recursive-delete-fix
Reviewer Review Type Date Requested Status
Ricardo Salveti 2015-01-26 Approve on 2015-01-26
PS Jenkins bot continuous-integration Approve on 2015-01-26
Review via email: mp+247646@code.launchpad.net

Commit message

Fix crash when recursively deleting directories; due to the concurrency between inotify notifications from filesystem changes and the delete method already removing items from the database.

Description of the change

Fix crash when recursively deleting directories; due to the concurrency between inotify notifications from filesystem changes and the delete method already removing items from the database.

To post a comment you must log in.
Ricardo Salveti (rsalveti) wrote :

LGTM

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'server/UbuntuMtpDatabase.h'
2--- server/UbuntuMtpDatabase.h 2014-09-08 19:27:06 +0000
3+++ server/UbuntuMtpDatabase.h 2015-01-26 20:06:32 +0000
4@@ -252,6 +252,7 @@
5 const char* cdata = processed + asio::buffer_cast<const char*>(buf.data());
6 const inotify_event* ievent = reinterpret_cast<const inotify_event*>(cdata);
7 MtpObjectHandle parent;
8+ path p;
9
10 processed += sizeof(inotify_event) + ievent->len;
11
12@@ -262,7 +263,12 @@
13 }
14 }
15
16- path p(db.at(parent).path + "/" + ievent->name);
17+ try {
18+ p = path(db.at(parent).path + "/" + ievent->name);
19+ } catch (...) {
20+ PLOG(WARNING) << "Could not find parent for event " << ievent->name;
21+ continue;
22+ }
23
24 if(ievent->len > 0 && ievent->mask & IN_MODIFY)
25 {

Subscribers

People subscribed via source and target branches