Since everybody is having so much fun moving various MAX defines
around, I thought I'd find one to play with.

The C standard says TMP_MAX should be the number of filenames tmpnam()
can create. Our current define is very old, and reflects an outdated
implementation. The correct number is pretty gigantor, but for the
sake of simplicity and to not overflow int, I've capped it.

Index: stdio.h
===================================================================
RCS file: /cvs/src/include/stdio.h,v
retrieving revision 1.49
diff -u -p -r1.49 stdio.h
--- stdio.h     27 Mar 2014 15:28:16 -0000      1.49
+++ stdio.h     20 Jan 2015 06:34:10 -0000
@@ -191,7 +191,7 @@ __END_DECLS
 #define        P_tmpdir        "/tmp/"
 #endif
 #define        L_tmpnam        1024    /* XXX must be == PATH_MAX */
-#define        TMP_MAX         308915776
+#define        TMP_MAX         0x7fffffff      /* more, but don't overflow int 
*/
 
 #ifndef SEEK_SET
 #define        SEEK_SET        0       /* set file offset to offset */

Reply via email to