[BACK]Return to function.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / find

Diff for /src/usr.bin/find/function.c between version 1.47 and 1.48

version 1.47, 2019/06/28 13:35:01 version 1.48, 2020/04/09 10:27:32
Line 538 
Line 538 
  *   *
  *      If -exec ... {} +, use only the first array, but make it large   *      If -exec ... {} +, use only the first array, but make it large
  *      enough to hold 5000 args (cf. src/usr.bin/xargs/xargs.c for a   *      enough to hold 5000 args (cf. src/usr.bin/xargs/xargs.c for a
  *      discussion), and then allocate ARG_MAX - 4K of space for args.   *      discussion), and then allocate space for args.
  */   */
 PLAN *  PLAN *
 c_exec(char *unused, char ***argvp, int isok)  c_exec(char *unused, char ***argvp, int isok)
Line 587 
Line 587 
                 errx(1, "-ok: terminating \"+\" not permitted.");                  errx(1, "-ok: terminating \"+\" not permitted.");
   
         if (new->flags & F_PLUSSET) {          if (new->flags & F_PLUSSET) {
                   long arg_max;
                 u_int c, bufsize;                  u_int c, bufsize;
   
                 cnt = ap - *argvp - 1;                  /* units are words */                  cnt = ap - *argvp - 1;                  /* units are words */
Line 599 
Line 600 
                 new->ep_narg = 0;                  new->ep_narg = 0;
   
                 /*                  /*
                    * Compute the maximum space we can use for arguments
                    * passed to execve(2).
                    */
                   arg_max = sysconf(_SC_ARG_MAX);
                   if (arg_max == -1)
                           err(1, "sysconf(_SC_ARG_MAX) failed");
   
                   /*
                  * Count up the space of the user's arguments, and                   * Count up the space of the user's arguments, and
                  * subtract that from what we allocate.                   * subtract that from what we allocate.
                  */                   */
Line 608 
Line 617 
                         c += strlen(*argv) + 1;                          c += strlen(*argv) + 1;
                         new->e_argv[cnt] = *argv;                          new->e_argv[cnt] = *argv;
                 }                  }
                 bufsize = ARG_MAX - 4 * 1024 - c;                  bufsize = arg_max - 4 * 1024 - c;
   
   
                 /*                  /*
                  * Allocate, and then initialize current, base, and                   * Allocate, and then initialize current, base, and

Legend:
Removed from v.1.47  
changed lines
  Added in v.1.48