X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fsrc%2Ftransports%2Fappendfile.c;h=8f26c71ba3b7e99b949369c207c28c89e3c1c581;hb=9f01e50d7efc5c625614e4e055790ca4a92a52a8;hp=5d23008f85e6b536c1b22f75fe800a2e59140e5f;hpb=f3ebb786e451da973560f1c9d8cdb151d25108b5;p=user%2Fhenk%2Fcode%2Fexim.git diff --git a/src/src/transports/appendfile.c b/src/src/transports/appendfile.c index 5d23008f8..8f26c71ba 100644 --- a/src/src/transports/appendfile.c +++ b/src/src/transports/appendfile.c @@ -773,10 +773,9 @@ int count = *countptr; struct dirent *ent; struct stat statbuf; -dir = opendir(CS dirname); -if (dir == NULL) return 0; +if (!(dir = opendir(CS dirname))) return 0; -while ((ent = readdir(dir)) != NULL) +while ((ent = readdir(dir))) { uschar * path, * name = US ent->d_name; @@ -815,13 +814,12 @@ while ((ent = readdir(dir)) != NULL) DEBUG(D_transport) debug_printf("check_dir_size: stat error %d for %s: %s\n", errno, path, strerror(errno)); - continue; } - - if ((statbuf.st_mode & S_IFMT) == S_IFREG) - sum += statbuf.st_size; - else if ((statbuf.st_mode & S_IFMT) == S_IFDIR) - sum += check_dir_size(path, &count, regex); + else + if ((statbuf.st_mode & S_IFMT) == S_IFREG) + sum += statbuf.st_size / statbuf.st_nlink; + else if ((statbuf.st_mode & S_IFMT) == S_IFDIR) + sum += check_dir_size(path, &count, regex); } closedir(dir);