From edba905a3981042c8f1b3f51ac66a32a451dc482 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ville=20Skytt=C3=A4?= Date: Sat, 5 Nov 2011 23:21:25 +0200 Subject: Reduce scope of some variables. --- txtrecv.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/txtrecv.c b/txtrecv.c index 5acf2c8..a461d05 100644 --- a/txtrecv.c +++ b/txtrecv.c @@ -65,11 +65,12 @@ int Storage::cleanSubDir(const char *dir) { static bool reportedError=false; //avoid filling up syslog DIR *d=opendir(dir); bool hadError=false; - int bytesDeleted=0, filesize; + int bytesDeleted=0; if (d) { struct dirent *txtfile, path; struct stat txtfilestat; char fullPath[PATH_MAX]; + int filesize; while ( (!readdir_r(d, &path, &txtfile) && txtfile != NULL) ) { int len=strlen(txtfile->d_name); //check that the file end with .vtx to avoid accidents and disasters @@ -128,9 +129,9 @@ void Storage::freeSpace() { time_t min=time(0); char minDir[PATH_MAX]; char fullPath[PATH_MAX]; - int haveDir=0; DIR *top=opendir(getRootDir()); if (top) { + int haveDir=0; struct dirent *chandir, path; struct stat chandirstat; while ( (!readdir_r(top, &path, &chandir) && chandir != NULL) ) { -- cgit v1.2.3