aboutsummaryrefslogtreecommitdiff
path: root/libbb/isdirectory.c
diff options
context:
space:
mode:
authorGlenn L McGrath <bug1@ihug.co.nz>2003-05-26 14:07:50 +0000
committerGlenn L McGrath <bug1@ihug.co.nz>2003-05-26 14:07:50 +0000
commit393183dccc4d100366972bdbbdc6e03a77839120 (patch)
treed2e94dac0f1f5da5cb3ecb927b78c4c2a02f4ea6 /libbb/isdirectory.c
parentddfe18df75c15be4a2aadddb241c3b86b1e2968a (diff)
downloadbusybox-w32-393183dccc4d100366972bdbbdc6e03a77839120.tar.gz
busybox-w32-393183dccc4d100366972bdbbdc6e03a77839120.tar.bz2
busybox-w32-393183dccc4d100366972bdbbdc6e03a77839120.zip
Vodz, last_patch_86
Diffstat (limited to 'libbb/isdirectory.c')
-rw-r--r--libbb/isdirectory.c12
1 files changed, 3 insertions, 9 deletions
diff --git a/libbb/isdirectory.c b/libbb/isdirectory.c
index e8ef2df14..e9b106aa3 100644
--- a/libbb/isdirectory.c
+++ b/libbb/isdirectory.c
@@ -20,8 +20,6 @@
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 */ 21 */
22 22
23#include <stdio.h>
24#include <stdlib.h>
25#include <sys/stat.h> 23#include <sys/stat.h>
26#include "libbb.h" 24#include "libbb.h"
27 25
@@ -32,11 +30,11 @@
32int is_directory(const char *fileName, const int followLinks, struct stat *statBuf) 30int is_directory(const char *fileName, const int followLinks, struct stat *statBuf)
33{ 31{
34 int status; 32 int status;
35 int didMalloc = 0; 33 struct stat astatBuf;
36 34
37 if (statBuf == NULL) { 35 if (statBuf == NULL) {
38 statBuf = (struct stat *)xmalloc(sizeof(struct stat)); 36 /* set from auto stack buffer */
39 ++didMalloc; 37 statBuf = &astatBuf;
40 } 38 }
41 39
42 if (followLinks) 40 if (followLinks)
@@ -49,10 +47,6 @@ int is_directory(const char *fileName, const int followLinks, struct stat *statB
49 } 47 }
50 else status = TRUE; 48 else status = TRUE;
51 49
52 if (didMalloc) {
53 free(statBuf);
54 statBuf = NULL;
55 }
56 return status; 50 return status;
57} 51}
58 52