[prev in list] [next in list] [prev in thread] [next in thread] 

List:       busybox
Subject:    [PATCH 6/8] chpst: tiny shrinkage and add possible TODO
From:       Bernhard Reutner-Fischer <rep.dot.nop () gmail ! com>
Date:       2009-10-26 22:27:07
Message-ID: 1256596029-511-7-git-send-email-rep.dot.nop () gmail ! com
[Download RAW message or body]

   text	   data	    bss	    dec	    hex	filename
      1398	      0	      0	   1398	    576	runit/chpst.o.old
      1385	      0	      0	   1385	    569	runit/chpst.o

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
---
 runit/chpst.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/runit/chpst.c b/runit/chpst.c
index 270ec0a..082d726 100644
--- a/runit/chpst.c
+++ b/runit/chpst.c
@@ -92,6 +92,7 @@ enum {
 	OPT_2 = (1 << 20) * ENABLE_CHPST,
 };
 
+/* TODO: use recursive_action? */
 static NOINLINE void edir(const char *directory_name)
 {
 	int wdir;
@@ -101,11 +102,9 @@ static NOINLINE void edir(const char *directory_name)
 
 	wdir = xopen(".", O_RDONLY | O_NDELAY);
 	xchdir(directory_name);
-	dir = opendir(".");
-	if (!dir)
-		bb_perror_msg_and_die("opendir %s", directory_name);
+	dir = xopendir(".");
 	for (;;) {
-		char buf[256];
+		RESERVE_CONFIG_BUFFER(buf, 256);
 		char *tail;
 		int size;
 
@@ -149,6 +148,7 @@ static NOINLINE void edir(const char *directory_name)
 				break;
 		}
 		xsetenv(d->d_name, buf);
+		RELEASE_CONFIG_BUFFER(buf);
 	}
 	closedir(dir);
 	if (fchdir(wdir) == -1)
-- 
1.6.3.3

_______________________________________________
busybox mailing list
busybox@busybox.net
http://lists.busybox.net/mailman/listinfo/busybox
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic