Module Name: src Committed By: rillig Date: Fri Jan 7 21:04:50 UTC 2022
Modified Files: src/usr.bin/make: parse.c Log Message: make: in loadfile, use simpler magic numbers No functional change. To generate a diff of this commit: cvs rdiff -u -r1.633 -r1.634 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.633 src/usr.bin/make/parse.c:1.634 --- src/usr.bin/make/parse.c:1.633 Fri Jan 7 21:00:49 2022 +++ src/usr.bin/make/parse.c Fri Jan 7 21:04:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.633 2022/01/07 21:00:49 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.634 2022/01/07 21:04:50 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -106,7 +106,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.633 2022/01/07 21:00:49 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.634 2022/01/07 21:04:50 rillig Exp $"); /* * A file being read. @@ -305,14 +305,13 @@ loadfile(const char *path, int fd) struct stat st; bufSize = fstat(fd, &st) == 0 && S_ISREG(st.st_mode) && - st.st_size >= 1 && st.st_size <= 0x3fffffff + st.st_size > 0 && st.st_size < 1024 * 1024 * 1024 ? (size_t)st.st_size : 1024; Buf_InitSize(&buf, bufSize); for (;;) { if (buf.len == buf.cap) { - if (buf.cap > 0x1fffffff) { - errno = EFBIG; + if (buf.cap >= 512 * 1024 * 1024) { Error("%s: file too large", path); exit(2); /* Not 1 so -q can distinguish error */ }