diff --git a/ChangeLog b/ChangeLog index 478080dc..7f7924be 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4272,6 +4272,8 @@ v0.33.19 26-Oct-2001 old style tic files, they were not full 3d. Fixes for Sparc systems. The nodelist information now also holds the Txx flags. + The mkdirs function now needs a mode parameter for directory + creation. lang: Changed language prompts 6, 71, 429. diff --git a/mbcico/mbcico.c b/mbcico/mbcico.c index c2c7a8f2..f3fd2aa7 100644 --- a/mbcico/mbcico.c +++ b/mbcico/mbcico.c @@ -361,7 +361,7 @@ int main(int argc, char *argv[]) p = xstrcpy(inbound); p = xstrcat(p,(char *)"/tmp/fooinb"); - mkdirs(p); + mkdirs(p, 0700); free(p); maxrc=0; diff --git a/mbcico/openfile.c b/mbcico/openfile.c index b82c4c5d..540ffcba 100644 --- a/mbcico/openfile.c +++ b/mbcico/openfile.c @@ -1,11 +1,10 @@ /***************************************************************************** * - * File ..................: mbcico/openfile.c + * $Id$ * Purpose ...............: Fidonet mailer - * Last modification date : 12-May-2001 * ***************************************************************************** - * Copyright (C) 1997-2001 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -170,7 +169,7 @@ FILE *openfile(char *fname, time_t remtime, off_t remsize, off_t *resofs, int(*r * and try again. */ if ((infp = fopen(infpath,opentype)) == NULL) { - mkdirs(infpath); + mkdirs(infpath, 0770); if ((infp = fopen(infpath, opentype)) == NULL) { WriteError("$Cannot open local file \"%s\" for \"%s\"", infpath,opentype); free(infpath); diff --git a/mbcico/scanout.c b/mbcico/scanout.c index 5d16b890..24c7728f 100644 --- a/mbcico/scanout.c +++ b/mbcico/scanout.c @@ -71,7 +71,7 @@ static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispo * Create a fake filename, mkdirs() likes that. */ sprintf(fname, "%s/foo", dname); - (void)mkdirs(fname); + (void)mkdirs(fname, 0770); if ((dp = opendir(dname)) == NULL) { Syslog('o' ,"\"%s\" cannot be opened, proceed",MBSE_SS(dname)); return 0; diff --git a/mbfido/addbbs.c b/mbfido/addbbs.c index b4493cac..bc8dcb46 100644 --- a/mbfido/addbbs.c +++ b/mbfido/addbbs.c @@ -85,7 +85,7 @@ int Add_BBS() sprintf(temp1, "%s/%s", TIC.Inbound, TIC.NewName); sprintf(temp2, "%s/%s", TIC.BBSpath, TIC.NewName); - mkdirs(temp2); + mkdirs(temp2, 0755); if (file_cp(temp1, temp2) != 0) { WriteError("$Copy to %s failed", temp2); diff --git a/mbfido/forward.c b/mbfido/forward.c index 0d31eb41..76681a2b 100644 --- a/mbfido/forward.c +++ b/mbfido/forward.c @@ -162,7 +162,7 @@ void ForwardFile(fidoaddr Node, fa_list *sbl) * If we need a .TIC file, start creating it. */ if (nodes.Tic) { - mkdirs(ticfile); + mkdirs(ticfile, 0770); if ((fp = fopen(ticfile, "a+")) != NULL) { fprintf(fp, "Area %s\r\n", TIC.TicIn.Area); fprintf(fp, "Origin %s\r\n", TIC.TicIn.Origin); diff --git a/mbfido/makestat.c b/mbfido/makestat.c index 19f0f9ec..f22ac81a 100644 --- a/mbfido/makestat.c +++ b/mbfido/makestat.c @@ -173,7 +173,7 @@ FILE *newpage(char *Name, char *Title) later = time(NULL) + 86400; sprintf(linebuf, "%s/stat/%s.temp", CFG.www_root, Name); - mkdirs(linebuf); + mkdirs(linebuf, 0755); if ((fa = fopen(linebuf, "w")) == NULL) { WriteError("$Can't create %s", linebuf); diff --git a/mbfido/mbfadopt.c b/mbfido/mbfadopt.c index 27f10cd6..1c087ab2 100644 --- a/mbfido/mbfadopt.c +++ b/mbfido/mbfadopt.c @@ -82,7 +82,7 @@ void AdoptFile(int Area, char *File, char *Description) if ((unarc = unpacker(File)) == NULL) { Syslog('+', "No known archive: %s", File); sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), File); - mkdirs(temp2); + mkdirs(temp2, 0755); if (file_cp(temp, temp2)) { WriteError("Can't copy file to %s", temp2); if (!do_quiet) diff --git a/mbfido/mbfcheck.c b/mbfido/mbfcheck.c index 8b95a358..d5946dc5 100644 --- a/mbfido/mbfcheck.c +++ b/mbfido/mbfcheck.c @@ -114,7 +114,7 @@ void Check(void) if (access(area.Path, R_OK) == -1) { Syslog('!', "No dir: %s", area.Path); sprintf(newdir, "%s/foobar", area.Path); - mkdirs(newdir); + mkdirs(newdir, 0755); } sprintf(fAreas, "%s/fdb/fdb%d.data", getenv("MBSE_ROOT"), i); diff --git a/mbfido/mbfimport.c b/mbfido/mbfimport.c index 0c0e51e1..b2dfdc9b 100644 --- a/mbfido/mbfimport.c +++ b/mbfido/mbfimport.c @@ -103,7 +103,7 @@ void ImportFiles(int Area) if ((unarc = unpacker(temp)) == NULL) { Syslog('+', "Unknown archive format %s", temp); sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), fdb.LName); - mkdirs(temp2); + mkdirs(temp2, 0755); if (file_cp(temp, temp2)) { WriteError("Can't copy file to %s", temp2); Doit = FALSE; @@ -292,7 +292,7 @@ void ImportFiles(int Area) if ((unarc = unpacker(temp)) == NULL) { Syslog('+', "Unknown archive format %s", temp); sprintf(temp2, "%s/tmp/arc/%s", getenv("MBSE_ROOT"), fdb.LName); - mkdirs(temp2); + mkdirs(temp2, 0755); if (file_cp(temp, temp2)) { WriteError("Can't copy file to %s", temp2); Doit = FALSE; diff --git a/mbfido/mbfindex.c b/mbfido/mbfindex.c index a92bcd51..a749367f 100644 --- a/mbfido/mbfindex.c +++ b/mbfido/mbfindex.c @@ -483,7 +483,7 @@ void Index(void) Syslog('!', "Create dir: %s", area.Path); newdir = xstrcpy(area.Path); newdir = xstrcat(newdir, (char *)"/"); - mkdirs(newdir); + mkdirs(newdir, 0755); free(newdir); newdir = NULL; } diff --git a/mbfido/mbfkill.c b/mbfido/mbfkill.c index 389cf26f..dd28726c 100644 --- a/mbfido/mbfkill.c +++ b/mbfido/mbfkill.c @@ -108,7 +108,7 @@ void Kill(void) Syslog('!', "Create dir: %s", area.Path); newdir = xstrcpy(area.Path); newdir = xstrcat(newdir, (char *)"/"); - mkdirs(newdir); + mkdirs(newdir, 0755); free(newdir); newdir = NULL; } diff --git a/mbfido/mbfutil.c b/mbfido/mbfutil.c index 8f481dab..fcc5e743 100644 --- a/mbfido/mbfutil.c +++ b/mbfido/mbfutil.c @@ -309,7 +309,7 @@ int AddFile(struct FILERecord fdb, int Area, char *DestPath, char *FromPath) FILE *fp1, *fp2; int i, Insert, Done = FALSE, Found = FALSE; - mkdirs(DestPath); + mkdirs(DestPath, 0755); if (file_cp(FromPath, DestPath)) { WriteError("Can't move file in place"); return FALSE; @@ -445,7 +445,7 @@ int CheckFDB(int Area, char *Path) */ if (access(Path, W_OK) == -1) { sprintf(temp, "%s/foobar", Path); - if (mkdirs(temp)) + if (mkdirs(temp, 0755)) Syslog('+', "Created directory %s", Path); } diff --git a/mbfido/mover.c b/mbfido/mover.c index 37caf615..c3c1f18a 100644 --- a/mbfido/mover.c +++ b/mbfido/mover.c @@ -50,7 +50,7 @@ void mover(char *fn) sprintf(To, "%s/%s", CFG.badtic, fn); Syslog('!', "Moving %s to %s", From, To); - if (mkdirs(To)) { + if (mkdirs(To, 0770)) { if (file_mv(From, To) != 0) WriteError("$Failed to move %s to %s", From, To); } diff --git a/mbsebbs/exitinfo.c b/mbsebbs/exitinfo.c index b0c9a909..e6b2ac65 100644 --- a/mbsebbs/exitinfo.c +++ b/mbsebbs/exitinfo.c @@ -106,7 +106,7 @@ void ReadExitinfo() temp = calloc(PATH_MAX, sizeof(char)); sprintf(temp, "%s/%s/exitinfo", CFG.bbs_usersdir, sUnixName); - mkdirs(temp); + mkdirs(temp, 0770); if ((pExitinfo = fopen(temp,"r+b")) == NULL) InitExitinfo(); else { diff --git a/mbsetup/ledit.c b/mbsetup/ledit.c index 3487c53c..27c9f6b0 100644 --- a/mbsetup/ledit.c +++ b/mbsetup/ledit.c @@ -575,7 +575,7 @@ char *edit_pth(int y, int x, int l, char *line, char *help) temp = xstrcat(temp, (char *)"/foobar"); if (access(s, R_OK)) { if (yes_no((char *)"Path doesn't exist, create")) - if (! mkdirs(temp)) + if (! mkdirs(temp, 0775)) errmsg((char *)"Can't create path"); } } @@ -602,7 +602,7 @@ char *edit_jam(int y, int x, int l, char *line, char *help) temp = xstrcpy(s); temp = xstrcat(temp, (char *)".jhr"); if (access(temp, W_OK)) { - if (mkdirs(s)) { + if (mkdirs(s, 0770)) { if (yes_no((char *)"Messagebase doesn't exist, create")) { if (Msg_Open(s)) Msg_Close(); diff --git a/mbsetup/m_farea.c b/mbsetup/m_farea.c index 5b11ec33..2271fd98 100644 --- a/mbsetup/m_farea.c +++ b/mbsetup/m_farea.c @@ -81,7 +81,7 @@ int CountFilearea(void) fclose(fil); chmod(ffile, 0640); sprintf(ffile, "%s/foobar", area.Path); - mkdirs(ffile); + mkdirs(ffile, 0755); return 1; } else return -1; diff --git a/mbsetup/m_marea.c b/mbsetup/m_marea.c index 9627f76a..a6def04c 100644 --- a/mbsetup/m_marea.c +++ b/mbsetup/m_marea.c @@ -93,7 +93,7 @@ int CountMsgarea(void) msgs.Ftncode = CHRS_DEFAULT_FTN; strcpy(msgs.Origin, CFG.origin); fwrite(&msgs, sizeof(msgs), 1, fil); - mkdirs(msgs.Base); + mkdirs(msgs.Base, 0770); if (Msg_Open(msgs.Base)) Msg_Close(); memset(&syscon, 0, sizeof(syscon)); @@ -118,7 +118,7 @@ int CountMsgarea(void) msgs.Rfccode = CHRS_DEFAULT_RFC; msgs.Ftncode = CHRS_DEFAULT_FTN; fwrite(&msgs, sizeof(msgs), 1, fil); - mkdirs(msgs.Base); + mkdirs(msgs.Base, 0770); if (Msg_Open(msgs.Base)) Msg_Close(); for (i = 1; i <= CFG.toss_systems; i++) @@ -142,7 +142,7 @@ int CountMsgarea(void) msgs.Rfccode = CHRS_DEFAULT_RFC; msgs.Ftncode = CHRS_DEFAULT_FTN; fwrite(&msgs, sizeof(msgs), 1, fil); - mkdirs(msgs.Base); + mkdirs(msgs.Base, 0770); if (Msg_Open(msgs.Base)) for (i = 1; i <= CFG.toss_systems; i++) fwrite(&syscon, sizeof(syscon), 1, fil); diff --git a/mbtask/scanout.c b/mbtask/scanout.c index f745a26d..3b1dda40 100644 --- a/mbtask/scanout.c +++ b/mbtask/scanout.c @@ -71,7 +71,7 @@ static int scan_dir(int (*fn)(faddr *, char, int, char *), char *dname, int ispo * Create a fake filename, mkdirs() likes that. */ sprintf(fname, "%s/foo", dname); - (void)mkdirs(fname); + (void)mkdirs(fname, 0770); if ((dp = opendir(dname)) == NULL) { tasklog('o' ,"\"%s\" cannot be opened, proceed",MBSE_SS(dname)); return 0; diff --git a/mbtask/taskutil.c b/mbtask/taskutil.c index 27ed01b0..951ea8f0 100644 --- a/mbtask/taskutil.c +++ b/mbtask/taskutil.c @@ -260,7 +260,7 @@ int file_exist(char *path, int mode) /* * Make directory tree, the name must end with a / */ -int mkdirs(char *name) +int mkdirs(char *name, mode_t mode) { char buf[PATH_MAX], *p, *q; int rc, last = 0, oldmask; @@ -274,7 +274,7 @@ int mkdirs(char *name) oldmask = umask(000); while ((q = strchr(p, '/'))) { *q = '\0'; - rc = mkdir(buf, 0775); + rc = mkdir(buf, mode); last = errno; *q = '/'; p = q+1; diff --git a/mbtask/taskutil.h b/mbtask/taskutil.h index b0421a2f..443c3f61 100644 --- a/mbtask/taskutil.h +++ b/mbtask/taskutil.h @@ -30,7 +30,7 @@ void TouchSema(char *); void RemoveSema(char *); int IsSema(char *); int file_exist(char *, int); -int mkdirs(char *); +int mkdirs(char *, mode_t); long file_size(char *); time_t file_time(char *); char *ascfnode(fidoaddr, int);