changeset 45851:81da6feb5000 stable

chg: reset errno prior to calling strtol() Otherwise we can't figure out if the last strtol() invocation failed or not.
author Yuya Nishihara <yuya@tcha.org>
date Tue, 03 Nov 2020 11:24:21 +0900
parents 9534de20358f
children fdd54a876213
files contrib/chg/chg.c
diffstat 1 files changed, 1 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/contrib/chg/chg.c	Tue Nov 03 11:15:50 2020 +0900
+++ b/contrib/chg/chg.c	Tue Nov 03 11:24:21 2020 +0900
@@ -276,6 +276,7 @@
 		debugmsg("closing files based on /proc contents");
 		struct dirent *de;
 		while ((de = readdir(dp))) {
+			errno = 0;
 			char *end;
 			long fd_value = strtol(de->d_name, &end, 10);
 			if (end == de->d_name) {