components/cups/patches/cups-lpd-huge-jobs-final.patch
branchs11u3-sru
changeset 6438 6e119d670a88
equal deleted inserted replaced
6436:6f99aa91162f 6438:6e119d670a88
       
     1 Source:
       
     2   Slightly fixes the original patch:
       
     3    https://www.cups.org/strfiles.php/3253/cups-lpd-hugh-jobs.patch
       
     4   from: https://www.cups.org/str.php?L4351
       
     5    ...to work on both (LP32 and LP64) program bitnesses by not using an obscure data types.
       
     6 
       
     7 Community promotion: promoted back on https://www.cups.org/str.php?L4351
       
     8 
       
     9 --- scheduler/cups-lpd.c	2016-02-15 16:56:40.890845828 -0800
       
    10 +++ scheduler/cups-lpd.c	2016-02-15 17:13:16.665739315 -0800
       
    11 @@ -912,6 +912,7 @@
       
    12  {
       
    13    http_t	*http;			/* HTTP connection */
       
    14    int		i;			/* Looping var */
       
    15 +  long long	ll;			/* Looping var for hugh loops */
       
    16    int		status;			/* Command status */
       
    17    int		fd;			/* Temporary file */
       
    18    FILE		*fp;			/* File pointer */
       
    19 @@ -984,6 +985,7 @@
       
    20    status   = 0;
       
    21    num_data = 0;
       
    22    fd       = -1;
       
    23 +  bytes    = 0;
       
    24  
       
    25    control[0] = '\0';
       
    26  
       
    27 @@ -1099,13 +1101,16 @@
       
    28     /*
       
    29      * Copy the data or control file from the client...
       
    30      */
       
    31 +    /* 
       
    32 +     * syslog(LOG_INFO, "count=%s lcount=%lld sizeof_line %d", id, count, atol(count), sizeof(line)); 
       
    33 +     */
       
    34  
       
    35 -    for (i = atoi(count); i > 0; i -= bytes)
       
    36 +    for (ll = atoll(count); ll > 0; ll -= bytes)
       
    37      {
       
    38 -      if (i > sizeof(line))
       
    39 +      if (ll > sizeof(line))
       
    40          bytes = sizeof(line);
       
    41        else
       
    42 -        bytes = i;
       
    43 +        bytes = (long long) ll;
       
    44  
       
    45        if ((bytes = fread(line, 1, bytes, stdin)) > 0)
       
    46          bytes = write(fd, line, bytes);