From 6937c3f2bd8cf40ce8d2f0d3fea37f076e4ce709 Mon Sep 17 00:00:00 2001 From: Bjørn Mork Date: Sat, 4 Mar 2017 20:59:09 +0100 Subject: ripe-atlas-fw: imported version 4740 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Bjørn Mork --- networking/httppost.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'networking/httppost.c') 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); -- cgit v1.2.3