"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "miscutil.c" between
leafnode-1.11.11.tar.gz and leafnode-1.11.12.tar.bz2

About: Leafnode is a store & forward NNTP proxy for small (dialup) sites.

miscutil.c  (leafnode-1.11.11):miscutil.c  (leafnode-1.11.12.tar.bz2)
skipping to change at line 66 skipping to change at line 66
} }
char fqdn[FQDNLEN + 1] = ""; char fqdn[FQDNLEN + 1] = "";
static const mode_t default_umask = 0002; static const mode_t default_umask = 0002;
/* xoverutil global vars */ /* xoverutil global vars */
struct xoverinfo *xoverinfo; struct xoverinfo *xoverinfo;
unsigned long xfirst, xlast; unsigned long xfirst, xlast;
/* kludge around C89 const not being a compile-time constant */
enum { hashsize = 1000 };
static int static int
createmsgiddir(void) { createmsgiddir(void) {
mastr *dir = mastr_new(1024); mastr *dir = mastr_new(1024);
mastr *mid = mastr_new(1024); mastr *mid = mastr_new(1024);
DIR *d; DIR *d;
int rc = 0; int rc = 0;
int havedir[1000] = {0}; int havedir[hashsize] = {0};
mastr_vcat(dir, spooldir, "/message.id", NULL); mastr_vcat(dir, spooldir, "/message.id", NULL);
d = opendir(mastr_str(dir)); d = opendir(mastr_str(dir));
if (d) { if (d) {
struct dirent *de; struct dirent *de;
unsigned long u; unsigned long u;
const char *t; const char *t;
char *e; char *e;
/* read directory - should be faster than stat */ /* read directory - should be faster than stat */
while(errno = 0, de = readdir(d)) { while(errno = 0, de = readdir(d)) {
t = de->d_name; t = de->d_name;
if (isdigit((unsigned char)*t)) { if (isdigit((unsigned char)*t)) {
u = strtoul(t, &e, 10); u = strtoul(t, &e, 10);
if (e > t) if (e > t && u < hashsize)
havedir[u] = 1; havedir[u] = 1;
} }
} }
if (errno) if (errno)
ln_log(LNLOG_SERR, LNLOG_CTOP, "error reading directory %s: %m", ln_log(LNLOG_SERR, LNLOG_CTOP, "error reading directory %s: %m",
mastr_str(dir)); mastr_str(dir));
closedir(d); closedir(d);
/* create missing */ /* create missing */
for(u = 0; u < 1000; u++) { for(u = 0; u < hashsize; u++) {
char b[4]; char b[4];
snprintf(b, sizeof(b), "%03lu", u); snprintf(b, sizeof(b), "%03lu", u);
mastr_clear(mid); mastr_clear(mid);
if (!havedir[u]) { if (!havedir[u]) {
mastr_vcat(mid, spooldir, "/message.id/", b, NULL); mastr_vcat(mid, spooldir, "/message.id/", b, NULL);
if (mkdir(mastr_str(mid), 02755)) { if (mkdir(mastr_str(mid), 02755)) {
ln_log(LNLOG_SERR, LNLOG_CTOP, "error creating directory %s: %m", ln_log(LNLOG_SERR, LNLOG_CTOP, "error creating directory %s: %m",
mastr_str(mid)); mastr_str(mid));
break; break;
 End of changes. 4 change blocks. 
3 lines changed or deleted 6 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)