- while ( (direntp = readdir( dirp )) != NULL ){
- dlen=strlen(direntp->d_name)-(sizeof(unsortext)-1);
- if (dlen<0) continue;
- if(strcmp(direntp->d_name+dlen,unsortext) != 0)
- continue;
- if(strcmp(direntp->d_name,"authfail.log.unsort") == 0)
- continue;
- if(strcmp(direntp->d_name,"download.unsort") == 0)
- continue;
-
- if (dlen>0) {
- if (dlen>=sizeof(user)) continue;
- safe_strcpy(user,direntp->d_name,dlen+1);
- } else {
- user[0]='\0';
- }
-
- clen=snprintf(csort,sizeof(csort),"sort -T \"%s\" -t \"\t\" -k 4,4 -k 1,1 -k 2,2 -o \"%s/%s.log\" \"%s/%s.unsort\"",
- tmp, tmp, user, tmp, user);
- if (clen>=sizeof(csort)) {
- debuga(_("user name too long to sort %s\n"),csort);
- exit(EXIT_FAILURE);
- }
- cstatus=system(csort);
- if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
- debuga(_("sort command return status %d\n"),WEXITSTATUS(cstatus));
- debuga(_("sort command: %s\n"),csort);
- exit(EXIT_FAILURE);
- }
- if (snprintf(wdname,sizeof(wdname),"%s/%s.unsort",tmp,user)>=sizeof(wdname)) {
- debuga(_("user name too long for %s/%s.unsort\n"),tmp,user);
- exit(EXIT_FAILURE);
- }
- if (unlink(wdname)) {
- debuga(_("Cannot delete %s - %s\n"),wdname,strerror(errno));
- exit(EXIT_FAILURE);
- }
+ cstatus=system(csort);
+ if (!WIFEXITED(cstatus) || WEXITSTATUS(cstatus)) {
+ debuga(__FILE__,__LINE__,_("sort command return status %d\n"),WEXITSTATUS(cstatus));
+ debuga(__FILE__,__LINE__,_("sort command: %s\n"),csort);
+ exit(EXIT_FAILURE);
+ }
+ if (snprintf(csort,sizeof(csort),"%s/%s.user_unsort",tmp,user)>=sizeof(csort)) {
+ debuga(__FILE__,__LINE__,_("User name too long to manufacture file name "));
+ debuga_more("%s/%s.user_unsort\n",tmp,user);
+ exit(EXIT_FAILURE);
+ }
+ if (!KeepTempLog && unlink(csort)) {
+ debuga(__FILE__,__LINE__,_("Cannot delete \"%s\": %s\n"),csort,strerror(errno));
+ exit(EXIT_FAILURE);