X-Git-Url: https://code.citadel.org/?p=citadel.git;a=blobdiff_plain;f=citadel%2Fmodules%2Fnetwork%2Fserv_netspool.c;fp=citadel%2Fmodules%2Fnetwork%2Fserv_netspool.c;h=a792601b34f29a8539554d5d664902d771f78150;hp=34ad8a6c4e3d998e99a1aeaa9c8fabccf9532d92;hb=8892feee2ba5acef4ff399fc1f019aae2234989a;hpb=4f16550e3fe10c62b691b3976ff8b4fccc9dd830 diff --git a/citadel/modules/network/serv_netspool.c b/citadel/modules/network/serv_netspool.c index 34ad8a6c4..a792601b3 100644 --- a/citadel/modules/network/serv_netspool.c +++ b/citadel/modules/network/serv_netspool.c @@ -826,7 +826,7 @@ void network_do_spoolin(HashList *working_ignetcfg, HashList *the_netmap, int *n return; } - while ( (filedir_entry = readdir(filedir)) , (filedir_entry != NULL)) + while ( (filedir_entry = readdir(dp)) , (filedir_entry != NULL)) { #ifdef _DIRENT_HAVE_D_NAMLEN d_namelen = filedir_entry->d_namlen; @@ -900,7 +900,6 @@ void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netm FDIOBuffer FDIO; int d_namelen; DIR *dp; - struct dirent *d; struct dirent *filedir_entry; const char *pch; char spooloutfilename[PATH_MAX]; @@ -913,12 +912,9 @@ void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netm int d_type = 0; /* Step 1: consolidate files in the outbound queue into one file per neighbor node */ - d = (struct dirent *)malloc(offsetof(struct dirent, d_name) + PATH_MAX + 1); - if (d == NULL) return; dp = opendir(ctdl_netout_dir); if (dp == NULL) { - free(d); return; } @@ -927,7 +923,7 @@ void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netm memset(&FDIO, 0, sizeof(FDIOBuffer)); FDIO.IOB = &IOB; - while ( (filedir_entry = readdir(filedir)) , (filedir_entry != NULL)) + while ( (filedir_entry = readdir(dp)) , (filedir_entry != NULL)) { #ifdef _DIRENT_HAVE_D_NAMLEN d_namelen = filedir_entry->d_namlen; @@ -1046,7 +1042,6 @@ void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netm if (nFailed > 0) { FreeStrBuf(&NextHop); syslog(LOG_INFO, "netspool: skipping Spoolcleanup because of %d files unprocessed.", nFailed); - return; } @@ -1054,11 +1049,10 @@ void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netm dp = opendir(ctdl_netout_dir); if (dp == NULL) { FreeStrBuf(&NextHop); - free(d); return; } - while ( (filedir_entry = readdir(filedir)) , (filedir_entry != NULL)) + while ( (filedir_entry = readdir(dp)) , (filedir_entry != NULL)) { #ifdef _DIRENT_HAVE_D_NAMLEN d_namelen = filedir_entry->d_namlen; @@ -1110,7 +1104,6 @@ void network_consolidate_spoolout(HashList *working_ignetcfg, HashList *the_netm } } FreeStrBuf(&NextHop); - free(d); closedir(dp); }