Commit 74ebca57 authored by R A Lichtensteiger's avatar R A Lichtensteiger Committed by Richard P. Curnow

Skip symlinks when using mbox

I use a lot of symlinks for people who have multiple email addresses, so that
the emails all land in the right place.

Unfortunately for me, mairix happily indexes all of those symlinks as files.  I
made some changes to mbox.c to have it skip symlinks while in
build_mbox_lists()
parent c74b79d7
...@@ -773,13 +773,20 @@ void build_mbox_lists(struct database *db, const char *folder_base, /*{{{*/ ...@@ -773,13 +773,20 @@ void build_mbox_lists(struct database *db, const char *folder_base, /*{{{*/
for (i=0; i<n_paths; i++) { for (i=0; i<n_paths; i++) {
char *path = paths[i]; char *path = paths[i];
if (stat(path, &sb) < 0) { if (lstat(path, &sb) < 0) {
/* can't stat */ /* can't stat */
} else { } else {
extant_mboxen[n_extant].full_path = new_string(path); if (S_ISLNK(sb.st_mode)) {
extant_mboxen[n_extant].mtime = sb.st_mtime; /* Skip mbox if symlink */
extant_mboxen[n_extant].size = sb.st_size; if (verbose) {
n_extant++; printf("%s is a link - skipping\n", path);
}
} else {
extant_mboxen[n_extant].full_path = new_string(path);
extant_mboxen[n_extant].mtime = sb.st_mtime;
extant_mboxen[n_extant].size = sb.st_size;
n_extant++;
}
} }
free(paths[i]); free(paths[i]);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment