aboutsummaryrefslogtreecommitdiff
path: root/libbb
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2006-09-23 16:01:09 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2006-09-23 16:01:09 +0000
commitc290563319b61c8230deca52ab625d8dc335e2d3 (patch)
tree0961ae48901bd3defbcc6bbd5cd57bd90a3f849e /libbb
parentc1876d7364a260e06cd23a3255b9058240527b02 (diff)
downloadbusybox-w32-c290563319b61c8230deca52ab625d8dc335e2d3.tar.gz
busybox-w32-c290563319b61c8230deca52ab625d8dc335e2d3.tar.bz2
busybox-w32-c290563319b61c8230deca52ab625d8dc335e2d3.zip
remove unneeded #includes, fix indentation
Diffstat (limited to 'libbb')
-rw-r--r--libbb/xgetcwd.c39
1 files changed, 17 insertions, 22 deletions
diff --git a/libbb/xgetcwd.c b/libbb/xgetcwd.c
index f6cfb34a7..0ac450d3b 100644
--- a/libbb/xgetcwd.c
+++ b/libbb/xgetcwd.c
@@ -7,11 +7,6 @@
7 * Special function for busybox written by Vladimir Oleynik <dzo@simtreas.ru> 7 * Special function for busybox written by Vladimir Oleynik <dzo@simtreas.ru>
8*/ 8*/
9 9
10#include <stdlib.h>
11#include <errno.h>
12#include <unistd.h>
13#include <limits.h>
14#include <sys/param.h>
15#include "libbb.h" 10#include "libbb.h"
16 11
17/* Amount to increase buffer size by in each try. */ 12/* Amount to increase buffer size by in each try. */
@@ -23,27 +18,27 @@
23*/ 18*/
24 19
25char * 20char *
26xgetcwd (char *cwd) 21xgetcwd(char *cwd)
27{ 22{
28 char *ret; 23 char *ret;
29 unsigned path_max; 24 unsigned path_max;
30 25
31 path_max = (unsigned) PATH_MAX; 26 path_max = (unsigned) PATH_MAX;
32 path_max += 2; /* The getcwd docs say to do this. */ 27 path_max += 2; /* The getcwd docs say to do this. */
33 28
34 if(cwd==0) 29 if (cwd==0)
35 cwd = xmalloc (path_max); 30 cwd = xmalloc(path_max);
36 31
37 while ((ret = getcwd (cwd, path_max)) == NULL && errno == ERANGE) { 32 while ((ret = getcwd(cwd, path_max)) == NULL && errno == ERANGE) {
38 path_max += PATH_INCR; 33 path_max += PATH_INCR;
39 cwd = xrealloc (cwd, path_max); 34 cwd = xrealloc(cwd, path_max);
40 } 35 }
41 36
42 if (ret == NULL) { 37 if (ret == NULL) {
43 free (cwd); 38 free(cwd);
44 bb_perror_msg("getcwd()"); 39 bb_perror_msg("getcwd");
45 return NULL; 40 return NULL;
46 } 41 }
47 42
48 return cwd; 43 return cwd;
49} 44}