backoff_db creation
Katsuhiro Kondou
Katsuhiro_Kondou at isc.org
Fri Jun 15 11:05:58 UTC 2001
In article <Pine.LNX.4.30.0105301249410.1220-200000 at marduk.litech.org>,
"Jeffrey M. Vinocur" <jeff at litech.org> wrote;
} Didn't get exhaustive testing -- somebody more familiar with file control
} stuff in C should look at it to make sure I didn't do anything really
} dumb.
}
} Also, I didn't think about what permissions backoffdb should have, so it
} just takes whatever the umask wants...that may not be right.
I think attached would be better. I'll commit soon.
--
Katsuhiro Kondou
Index: misc.c
===================================================================
RCS file: /home/kondou/news/inn/repository/inn/nnrpd/misc.c,v
retrieving revision 1.50
diff -u -r1.50 misc.c
--- misc.c 2001/05/05 16:08:23 1.50
+++ misc.c 2001/06/15 10:25:33
@@ -526,9 +526,21 @@
/* Need this database for backing off */
(void)strncpy(postrec_dir,PERMaccessconf->backoff_db,SMBUF);
if (stat(postrec_dir, &st) < 0) {
- syslog(L_ERROR, "%s cannot stat backoff_db '%s': %s",ClientHost,postrec_dir,strerror(errno));
+ if (ENOENT == errno) {
+ if (!MakeDirectory(postrec_dir, true)) {
+ syslog(L_ERROR, "%s cannot create backoff_db '%s': %s",ClientHost,postrec_dir,strerror(errno));
+ return;
+ }
+ } else {
+ syslog(L_ERROR, "%s cannot stat backoff_db '%s': %s",ClientHost,postrec_dir,strerror(errno));
+ return;
+ }
+ }
+ if (!S_ISDIR(st.st_mode)) {
+ syslog(L_ERROR, "%s backoff_db '%s' is not a directory",ClientHost,postrec_dir);
return;
}
+
BACKOFFenabled = TRUE;
return;
More information about the inn-patches
mailing list