- notmuch_filenames_move_to_next (filenames)) {
- filename = notmuch_filenames_get (filenames);
- fd = open (filename, O_RDONLY);
- if (fd != -1)
- break;
+ notmuch_filenames_move_to_next (filenames), i++) {
+ if (i >= duplicate) {
+ filename = notmuch_filenames_get (filenames);
+ fd = open (filename, O_RDONLY);
+ if (fd != -1) {
+ break;
+ } else {
+ if (duplicate > 0) {
+ fprintf (stderr, "Error opening %s: %s\n", filename, strerror (errno));
+ status = NOTMUCH_STATUS_FILE_ERROR;
+ goto DONE;
+ }
+ }
+ }