diff options
author | Bjørn Mork <bjorn@mork.no> | 2017-03-04 20:59:09 +0100 |
---|---|---|
committer | Bjørn Mork <bjorn@mork.no> | 2017-03-04 21:04:49 +0100 |
commit | 6937c3f2bd8cf40ce8d2f0d3fea37f076e4ce709 (patch) | |
tree | d93c729f5f045412b7bd94e0e9e908695eebce2b /networking/httppost.c | |
parent | 729eb50738777d6dbc27f81d854c824b32bebb05 (diff) |
ripe-atlas-fw: imported version 47404740
Signed-off-by: Bjørn Mork <bjorn@mork.no>
Diffstat (limited to 'networking/httppost.c')
-rw-r--r-- | networking/httppost.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/networking/httppost.c b/networking/httppost.c index 03cd72c..b6e01da 100644 --- a/networking/httppost.c +++ b/networking/httppost.c @@ -21,6 +21,9 @@ #define SAFE_PREFIX_DATA_NEW ATLAS_DATA_NEW #define SAFE_PREFIX_STATUS ATLAS_STATUS +/* Maximum number of files to post in one go with post-dir */ +#define MAX_FILES 1000 + struct option longopts[]= { { "delete-file", no_argument, NULL, 'd' }, @@ -939,6 +942,7 @@ static int connect_to_name(char *host, char *port) char *do_dir(char *dir_name, off_t curr_tot_size, off_t max_size, off_t *lenp) { + int file_count; size_t currsize, allocsize, dirlen, len; char *list, *tmplist, *path; DIR *dir; @@ -952,6 +956,7 @@ char *do_dir(char *dir_name, off_t curr_tot_size, off_t max_size, off_t *lenp) *lenp= 0; currsize= 0; allocsize= 0; + file_count= 0; list= NULL; dir= opendir(dir_name); if (dir == NULL) @@ -1012,6 +1017,11 @@ char *do_dir(char *dir_name, off_t curr_tot_size, off_t max_size, off_t *lenp) currsize += len; curr_tot_size += sb.st_size; *lenp += sb.st_size; + + file_count++; + + if (file_count >= MAX_FILES) + break; } closedir(dir); |