From c649f9b73e808ffb34b26034d9bdb564b35d5697 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Fr=C3=A9d=C3=A9ric=20Marchal?= Date: Tue, 1 Nov 2011 12:56:16 +0000 Subject: [PATCH] Delete the unused user's directories Some directories are created to store the user's data but if they end up not being used, they are deleted along with their content. It saves space on the disk. A nicer fix would be not to create the directories and their content in the first place but I'll keep that for the next release. --- html.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/html.c b/html.c index af07349..4950790 100644 --- a/html.c +++ b/html.c @@ -85,21 +85,23 @@ void htmlrel(void) exit(EXIT_FAILURE); } while ( (uinfo = userinfo_advancescan(uscan)) != NULL ) { - if (!uinfo->topuser) { - continue; - } - tmpsort(uinfo); - if (snprintf(warea,sizeof(warea),"%s/%s",outdirname,uinfo->filename)>=sizeof(warea)) { debuga(_("Destination directory too long: %s/%s\n"),outdirname,uinfo->filename); exit(EXIT_FAILURE); } + if (!uinfo->topuser) { + //! \todo Instead of deleting the supernumerary directories, don't create them in the first place. + unlinkdir(warea,0); + continue; + } + if (access(warea, R_OK) != 0) { if (mkdir(warea,0755)) { debuga(_("Cannot create directory %s - %s\n"),warea,strerror(errno)); exit(EXIT_FAILURE); } } + tmpsort(uinfo); report_day(uinfo); greport_day(uinfo); -- 2.47.2