From 5ee3f80ba726fdc9c7d33d1c8659d492e8ef7919 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Fri, 26 Dec 2003 12:25:25 +0000 Subject: [PATCH] Fixed failed point polls --- ChangeLog | 4 ++++ mbcico/outstat.c | 46 +++++++++++++++++++++++++--------------------- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0d14e37e..58226153 100644 --- a/ChangeLog +++ b/ChangeLog @@ -6,6 +6,10 @@ v0.39.5 24-Dec-2003 Binkp code cleanup. Allow m_file command in binkp during file transfer in progress. + mbout: + Poll, remove poll and request failed to points which had no + point directory in the outbound, now the directory is created. + script: Fixed NetBSD init script All init scripts now clean the ~/var/run directory and start diff --git a/mbcico/outstat.c b/mbcico/outstat.c index d1bdeea1..2e1012df 100644 --- a/mbcico/outstat.c +++ b/mbcico/outstat.c @@ -374,6 +374,7 @@ int poll(faddr *addr, int stop) return 0; pol = xstrcpy(polname(addr)); + mkdirs(pol, 0770); if (stop) { if (access(pol, R_OK) == 0) { @@ -413,6 +414,8 @@ int poll(faddr *addr, int stop) if ((fp = fopen(pol, "w+")) == NULL) { WriteError("$Can't create poll for %s", ascfnode(addr, 0x1f)); + if (!do_quiet) + printf("Can't create poll for %s\n", ascfnode(addr, 0x1f)); rc = MBERR_CANNOT_MAKE_POLL; } else { fclose(fp); @@ -467,31 +470,32 @@ int reset(faddr *addr) int freq(faddr *addr, char *fname) { - char *req; - FILE *fp; + char *req; + FILE *fp; - Syslog('o', "Freq %s %s", ascfnode(addr, 0x1f), fname); + Syslog('o', "Freq %s %s", ascfnode(addr, 0x1f), fname); - /* - * Append filename to .req file - */ - req = xstrcpy(reqname(addr)); - if ((fp = fopen(req, "a")) == NULL) { - WriteError("$Can't append to %s", req); - if (!do_quiet) - printf("File request failed\n"); - free(req); - return MBERR_REQUEST; - } - fprintf(fp, "%s\r\n", fname); - fclose(fp); - - Syslog('+', "File request \"%s\" from %s", fname, ascfnode(addr, 0x1f)); + /* + * Append filename to .req file + */ + req = xstrcpy(reqname(addr)); + mkdirs(req, 0770); + if ((fp = fopen(req, "a")) == NULL) { + WriteError("$Can't append to %s", req); if (!do_quiet) - printf("File request \"%s\" from %s\n", fname, ascfnode(addr, 0x1f)); - + printf("File request failed\n"); free(req); - return 0; + return MBERR_REQUEST; + } + fprintf(fp, "%s\r\n", fname); + fclose(fp); + + Syslog('+', "File request \"%s\" from %s", fname, ascfnode(addr, 0x1f)); + if (!do_quiet) + printf("File request \"%s\" from %s\n", fname, ascfnode(addr, 0x1f)); + + free(req); + return 0; }