You really don't get it. + unveil_list = calloc(2 * argc, sizeof(char*));
Imagine argc is 10000. + for (i = 2 * argc - 2; i >= 0; i -= 2) { + if (unveil_list[i]) { + if (unveil(unveil_list[i], "r") == -1) ... + if (unveil_list[i | 1]) { + if (unveil(unveil_list[i | 1], "cw") == -1) + err(1, "unveil"); ... E2BIG The addition of path would exceed the per-process limit for unveiled paths. Great, under fairly normal usage ftp aborts with an error. Since you start with up to 8 others, it looks like this limit is easily hit at around 120 filenames. So ftp simply fails to perform the task it is designed for. Your proposal is to break the command.