summary refs log tree commit diff
path: root/src/main.c
diff options
context:
space:
mode:
authorHerbert Xu <herbert@gondor.apana.org.au>2020-05-07 23:42:12 +1000
committerHerbert Xu <herbert@gondor.apana.org.au>2020-05-15 16:24:38 +1000
commit3e3e7af1a49273a5e49d50565b3b079a2ab19142 (patch)
treee39ad4bc65d7d7cb13f0d0c8d2b2b595bff40be4 /src/main.c
parentinput: Fix compiling against libedit with -fno-common (diff)
downloaddash-3e3e7af1a49273a5e49d50565b3b079a2ab19142.tar.gz
dash-3e3e7af1a49273a5e49d50565b3b079a2ab19142.zip
shell: Always use explicit large file API
There are some remaining stat/readdir calls in dash that may lead
to spurious EOVERFLOW errors on 32-bit platforms.  This patch changes
them (as well as open(2)) to use the explicit large file API.

Reported-by: Tatsuki Sugiura <sugi@nemui.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/main.c b/src/main.c
index 36431fc..7a28534 100644
--- a/src/main.c
+++ b/src/main.c
@@ -298,7 +298,7 @@ find_dot_file(char *basename)
 {
 	char *fullname;
 	const char *path = pathval();
-	struct stat statb;
+	struct stat64 statb;
 	int len;
 
 	/* don't try this for absolute or relative paths */
@@ -308,7 +308,7 @@ find_dot_file(char *basename)
 	while ((len = padvance(&path, basename)) >= 0) {
 		fullname = stackblock();
 		if ((!pathopt || *pathopt == 'f') &&
-		    !stat(fullname, &statb) && S_ISREG(statb.st_mode)) {
+		    !stat64(fullname, &statb) && S_ISREG(statb.st_mode)) {
 			/* This will be freed by the caller. */
 			return stalloc(len);
 		}