]> git.notmuchmail.org Git - notmuch/commitdiff
lib: Don't needlessly create directory docs in _notmuch_message_remove_filename
authorAustin Clements <amdragon@MIT.EDU>
Fri, 18 May 2012 04:13:42 +0000 (00:13 -0400)
committerDavid Bremner <bremner@debian.org>
Thu, 24 May 2012 01:32:12 +0000 (22:32 -0300)
Previously, if passed a filename with a directory that did not exist
in the database, _notmuch_message_remove_filename would needlessly
create that directory document.  Fix it so that doesn't happen.

lib/message.cc

index 8d552f1fc07d91d03f3fcbf94b49de17fc644581..67875065f5c93f01edbad2387172d3767be59364 100644 (file)
@@ -541,8 +541,8 @@ _notmuch_message_remove_filename (notmuch_message_t *message,
     Xapian::TermIterator i, last;
 
     status = _notmuch_database_filename_to_direntry (
-       local, message->notmuch, filename, NOTMUCH_FIND_CREATE, &direntry);
-    if (status)
+       local, message->notmuch, filename, NOTMUCH_FIND_LOOKUP, &direntry);
+    if (status || !direntry)
        return status;
 
     /* Unlink this file from its parent directory. */