Bug in subscriber searching function is_subbed_in()
I found out that the subscribercode searches the subscriber directory and tries to mmap the lockfile it created earlier which size is zero, hence the logentry:
/usr/bin/mlmmj-sub[25209]: subscriberfuncs.c:61: Could not mmap fd: Invalid argument
I modified the code to skip ALL files that starts with a dot, that takes care if . and .. directories aswell as the .$file.lock files.
Is this patch acceptable?
Regards,
Magnus
src/subscriberfuncs.c 2006-08-07 05:42:49.000000000 +0200 renamed from src/subscriberfuncs.c 2005-02-14 23:59:24.000000000 +0100 +2 -3
@@ -101,9 +101,8 @@ } while((dp = readdir(subddir)) != NULL) { - if(!strcmp(dp->d_name, ".")) - continue; - if(!strcmp(dp->d_name, "..")) + /* Skip "." ".." and ".*.lock" files */ + if(dp->d_name[0] = '.') continue; subreadname = concatstr(2, subddirname, dp->d_name);
Quoted 10 lines · Magnus Naeslund(k)
I found out that the subscribercode searches the subscriber directory and tries to mmap the lockfile it created earlier which size is zero, hence the logentry:
/usr/bin/mlmmj-sub[25209]: subscriberfuncs.c:61: Could not mmap fd: Invalid argument
I modified the code to skip ALL files that starts with a dot, that takes care if . and .. directories aswell as the .$file.lock files.
Is this patch acceptable?
Not really. It means it wont search .somesubshereinthis file. But to that bug, there's already a fix in the tree:
/* No need to check in 0-size file */
if(st.st_size = 0)
return (off_t)-1;So after ignoring . and .. we only work on files bigger than 0.
Signature · 4 lines
Mads Martin Joergensen, http://mmj.dk
"Why make things difficult, when it is possible to make them cryptic
and totally illogical, with just a little bit more effort?"
-- A. P. J.