diff --git a/lib/attach.c b/lib/attach.c index f678902a..ef974885 100644 --- a/lib/attach.c +++ b/lib/attach.c @@ -52,7 +52,7 @@ int attach(faddr noden, char *ofile, int mode, char flavor) * Check if outbound directory exists and * create if it doesn't exist. */ - mkdirs(ofile); + mkdirs(ofile, 0770); /* * Attach file to .flo diff --git a/lib/common.h b/lib/common.h index 15f9ace5..033d2033 100644 --- a/lib/common.h +++ b/lib/common.h @@ -459,7 +459,7 @@ int file_exist(char *path, int mode); long file_size(char *path); long file_crc(char *path, int); time_t file_time(char *path); -int mkdirs(char *name); +int mkdirs(char *name, mode_t); int diskfree(int); diff --git a/lib/mbfile.c b/lib/mbfile.c index 8717762f..90b297df 100644 --- a/lib/mbfile.c +++ b/lib/mbfile.c @@ -222,7 +222,7 @@ time_t file_time(char *path) /* * 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; @@ -236,7 +236,8 @@ int mkdirs(char *name) oldmask = umask(000); while ((q = strchr(p, '/'))) { *q = '\0'; - rc = mkdir(buf, 0775); + rc = mkdir(buf, mode); + Syslog('-', "mkdir(%s) rc=%d", buf, rc); last = errno; *q = '/'; p = q+1; @@ -257,7 +258,6 @@ int mkdirs(char *name) /* * Check free diskspace on most filesystems. Exclude check on floppyies, * CD's and /boot partition. The amount of needed space is given in MBytes. - * Currently only Linux is supported. */ int diskfree(int needed) { @@ -292,7 +292,7 @@ int diskfree(int needed) */ if (strncmp((char *)"/dev/fd", dev, 7) && strncmp((char *)"/boot", fs, 5) && (!strncmp((char *)"ext2", type, 4) || !strncmp((char *)"reiserfs", type, 8) || - !strncmp((char *)"ufs", type, 3) || + !strncmp((char *)"ufs", type, 3) || !strncmp((char *)"ffs", type, 3) || !strncmp((char *)"vfat", type, 4) || !strncmp((char *)"msdos", type, 5))) { if (statfs(fs, &sfs) == 0) { temp = (unsigned long)(sfs.f_bsize / 512L); diff --git a/lib/nodelock.c b/lib/nodelock.c index cc6014b1..0110dbad 100644 --- a/lib/nodelock.c +++ b/lib/nodelock.c @@ -1,11 +1,10 @@ /***************************************************************************** * - * File ..................: nodelock.c + * $Id$ * Purpose ...............: Node locking - * Last modification date : 18-Mar-2000 * ***************************************************************************** - * Copyright (C) 1997-2000 + * Copyright (C) 1997-2002 * * Michiel Broek FIDO: 2:280/2802 * Beekmansbos 10 @@ -51,7 +50,7 @@ int nodelock(faddr *addr) mypid = getpid(); sprintf(tmp, "aa%d", mypid); tfn = xstrcat(tfn, tmp); - mkdirs(tfn); + mkdirs(tfn, 0770); if ((fp = fopen(tfn,"w")) == NULL) { WriteError("$Can't open tmp file for bsy lock (%s) \"%s\"",ascfnode(addr, 0x1f), tfn); @@ -61,7 +60,7 @@ int nodelock(faddr *addr) fprintf(fp,"%10d\n", mypid); fclose(fp); - chmod(tfn, 0444); + chmod(tfn, 0440); if (link(tfn, fn) == 0) { unlink(tfn); free(tfn); diff --git a/lib/packet.c b/lib/packet.c index c1ec551c..68dba938 100644 --- a/lib/packet.c +++ b/lib/packet.c @@ -85,7 +85,7 @@ FILE *openpkt(FILE *pkt, faddr *addr, char flavor) pktroute.domain = xstrcpy(addr->domain); pktroute.name = NULL; Name = pktname(addr,flavor); - mkdirs(Name); + mkdirs(Name, 0770); if ((pktfp = fopen(Name, "r+")) == NULL) pktfp = fopen(Name,"w");