From 1216c9cebffbb345687f46bcf3d43ae1de21fb1e Mon Sep 17 00:00:00 2001 From: Joel Sherrill Date: Wed, 17 Apr 2002 14:01:34 +0000 Subject: 2002-04-17 Ralf Corsepius * libc/scandir.c: Initialize nitems = 0. --- c/src/exec/libcsupport/src/scandir.c | 3 +-- c/src/lib/ChangeLog | 4 ++++ c/src/lib/libc/scandir.c | 3 +-- cpukit/libcsupport/src/scandir.c | 3 +-- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/c/src/exec/libcsupport/src/scandir.c b/c/src/exec/libcsupport/src/scandir.c index ff527b13b4..e8ef3212d5 100644 --- a/c/src/exec/libcsupport/src/scandir.c +++ b/c/src/exec/libcsupport/src/scandir.c @@ -86,7 +86,7 @@ scandir(dirname, namelist, select, dcomp) register struct dirent *d = NULL; register struct dirent *p = NULL; register struct dirent **names = NULL; - register size_t nitems; + register size_t nitems = 0; struct stat stb; long arraysz; DIR *dirp = NULL; @@ -106,7 +106,6 @@ scandir(dirname, namelist, select, dcomp) if (names == NULL) goto cleanup_and_bail; - nitems = 0; while ((d = readdir(dirp)) != NULL) { if (select != NULL && !(*select)(d)) continue; /* just selected names */ diff --git a/c/src/lib/ChangeLog b/c/src/lib/ChangeLog index abf8d52320..cd826e9d76 100644 --- a/c/src/lib/ChangeLog +++ b/c/src/lib/ChangeLog @@ -1,3 +1,7 @@ +2002-04-17 Ralf Corsepius + + * libc/scandir.c: Initialize nitems = 0. + 2002-04-16 Ralf Corsepius * include/Makefile.am: Add stdint.h and inttypes.h. diff --git a/c/src/lib/libc/scandir.c b/c/src/lib/libc/scandir.c index ff527b13b4..e8ef3212d5 100644 --- a/c/src/lib/libc/scandir.c +++ b/c/src/lib/libc/scandir.c @@ -86,7 +86,7 @@ scandir(dirname, namelist, select, dcomp) register struct dirent *d = NULL; register struct dirent *p = NULL; register struct dirent **names = NULL; - register size_t nitems; + register size_t nitems = 0; struct stat stb; long arraysz; DIR *dirp = NULL; @@ -106,7 +106,6 @@ scandir(dirname, namelist, select, dcomp) if (names == NULL) goto cleanup_and_bail; - nitems = 0; while ((d = readdir(dirp)) != NULL) { if (select != NULL && !(*select)(d)) continue; /* just selected names */ diff --git a/cpukit/libcsupport/src/scandir.c b/cpukit/libcsupport/src/scandir.c index ff527b13b4..e8ef3212d5 100644 --- a/cpukit/libcsupport/src/scandir.c +++ b/cpukit/libcsupport/src/scandir.c @@ -86,7 +86,7 @@ scandir(dirname, namelist, select, dcomp) register struct dirent *d = NULL; register struct dirent *p = NULL; register struct dirent **names = NULL; - register size_t nitems; + register size_t nitems = 0; struct stat stb; long arraysz; DIR *dirp = NULL; @@ -106,7 +106,6 @@ scandir(dirname, namelist, select, dcomp) if (names == NULL) goto cleanup_and_bail; - nitems = 0; while ((d = readdir(dirp)) != NULL) { if (select != NULL && !(*select)(d)) continue; /* just selected names */ -- cgit v1.2.3