aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
authorandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-21 07:34:27 +0000
committerandersen <andersen@69ca8d6d-28ef-0310-b511-8ec308f3f277>2001-03-21 07:34:27 +0000
commit181385da6b3577bb300bcda2653623ae46928ad4 (patch)
treed1f07be4de0004fe5e30b44320e10285147e7944 /util-linux
parent0ccb1013f6746540ee25e7f070982d043e3ca949 (diff)
downloadbusybox-w32-181385da6b3577bb300bcda2653623ae46928ad4.tar.gz
busybox-w32-181385da6b3577bb300bcda2653623ae46928ad4.tar.bz2
busybox-w32-181385da6b3577bb300bcda2653623ae46928ad4.zip
A nice patch from Larry Doolittle that adds -Wshadow and
cleans up most of the now-revealed problems. git-svn-id: svn://busybox.net/trunk/busybox@2177 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/fsck_minix.c18
-rw-r--r--util-linux/nfsmount.c8
-rw-r--r--util-linux/rdate.c18
-rw-r--r--util-linux/umount.c14
4 files changed, 30 insertions, 28 deletions
diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c
index bd0c8a61c..a2421fc34 100644
--- a/util-linux/fsck_minix.c
+++ b/util-linux/fsck_minix.c
@@ -1439,18 +1439,18 @@ extern int fsck_minix_main(int argc, char **argv)
1439 check(); 1439 check();
1440 } 1440 }
1441 if (verbose) { 1441 if (verbose) {
1442 int i, free; 1442 int i, free_cnt;
1443 1443
1444 for (i = 1, free = 0; i <= INODES; i++) 1444 for (i = 1, free_cnt = 0; i <= INODES; i++)
1445 if (!inode_in_use(i)) 1445 if (!inode_in_use(i))
1446 free++; 1446 free_cnt++;
1447 printf("\n%6ld inodes used (%ld%%)\n", (INODES - free), 1447 printf("\n%6ld inodes used (%ld%%)\n", (INODES - free_cnt),
1448 100 * (INODES - free) / INODES); 1448 100 * (INODES - free_cnt) / INODES);
1449 for (i = FIRSTZONE, free = 0; i < ZONES; i++) 1449 for (i = FIRSTZONE, free_cnt = 0; i < ZONES; i++)
1450 if (!zone_in_use(i)) 1450 if (!zone_in_use(i))
1451 free++; 1451 free_cnt++;
1452 printf("%6ld zones used (%ld%%)\n", (ZONES - free), 1452 printf("%6ld zones used (%ld%%)\n", (ZONES - free_cnt),
1453 100 * (ZONES - free) / ZONES); 1453 100 * (ZONES - free_cnt) / ZONES);
1454 printf("\n%6d regular files\n" 1454 printf("\n%6d regular files\n"
1455 "%6d directories\n" 1455 "%6d directories\n"
1456 "%6d character device files\n" 1456 "%6d character device files\n"
diff --git a/util-linux/nfsmount.c b/util-linux/nfsmount.c
index cd815102c..6643ed5aa 100644
--- a/util-linux/nfsmount.c
+++ b/util-linux/nfsmount.c
@@ -157,7 +157,7 @@ static const int NFS_MOUNT_NONLM = 0x0200; /* 3 */
157#define HAVE_personality 157#define HAVE_personality
158#define HAVE_tm_gmtoff 158#define HAVE_tm_gmtoff
159 159
160static char *nfs_strerror(int stat); 160static char *nfs_strerror(int status);
161 161
162#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r)) 162#define MAKE_VERSION(p,q,r) (65536*(p) + 256*(q) + (r))
163#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2) 163#define MAX_NFSPROT ((nfs_mount_version >= 4) ? 3 : 2)
@@ -873,16 +873,16 @@ static struct {
873 { -1, EIO } 873 { -1, EIO }
874}; 874};
875 875
876static char *nfs_strerror(int stat) 876static char *nfs_strerror(int status)
877{ 877{
878 int i; 878 int i;
879 static char buf[256]; 879 static char buf[256];
880 880
881 for (i = 0; nfs_errtbl[i].stat != -1; i++) { 881 for (i = 0; nfs_errtbl[i].stat != -1; i++) {
882 if (nfs_errtbl[i].stat == stat) 882 if (nfs_errtbl[i].stat == status)
883 return strerror(nfs_errtbl[i].errnum); 883 return strerror(nfs_errtbl[i].errnum);
884 } 884 }
885 sprintf(buf, _("unknown nfs status return value: %d"), stat); 885 sprintf(buf, _("unknown nfs status return value: %d"), status);
886 return buf; 886 return buf;
887} 887}
888 888
diff --git a/util-linux/rdate.c b/util-linux/rdate.c
index 5f31282fc..ead1e7c7d 100644
--- a/util-linux/rdate.c
+++ b/util-linux/rdate.c
@@ -40,7 +40,7 @@ static const int RFC_868_BIAS = 2208988800UL;
40static time_t askremotedate(const char *host) 40static time_t askremotedate(const char *host)
41{ 41{
42 struct hostent *h; 42 struct hostent *h;
43 struct sockaddr_in sin; 43 struct sockaddr_in s_in;
44 struct servent *tserv; 44 struct servent *tserv;
45 unsigned long int nett, localt; 45 unsigned long int nett, localt;
46 int fd; 46 int fd;
@@ -54,11 +54,11 @@ static time_t askremotedate(const char *host)
54 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */ 54 if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0) /* get net connection */
55 perror_msg_and_die("%s", "socket"); 55 perror_msg_and_die("%s", "socket");
56 56
57 memcpy(&sin.sin_addr, h->h_addr, sizeof(sin.sin_addr)); 57 memcpy(&s_in.sin_addr, h->h_addr, sizeof(s_in.sin_addr));
58 sin.sin_port= tserv->s_port; 58 s_in.sin_port= tserv->s_port;
59 sin.sin_family = AF_INET; 59 s_in.sin_family = AF_INET;
60 60
61 if (connect(fd, (struct sockaddr *)&sin, sizeof(sin)) < 0) /* connect to time server */ 61 if (connect(fd, (struct sockaddr *)&s_in, sizeof(s_in)) < 0) /* connect to time server */
62 perror_msg_and_die("%s", host); 62 perror_msg_and_die("%s", host);
63 63
64 if (read(fd, (void *)&nett, 4) != 4) /* read time from server */ 64 if (read(fd, (void *)&nett, 4) != 4) /* read time from server */
@@ -79,7 +79,7 @@ static time_t askremotedate(const char *host)
79 79
80int rdate_main(int argc, char **argv) 80int rdate_main(int argc, char **argv)
81{ 81{
82 time_t time; 82 time_t remote_time;
83 int opt; 83 int opt;
84 int setdate = 0; 84 int setdate = 0;
85 int printdate= 0; 85 int printdate= 0;
@@ -111,15 +111,15 @@ int rdate_main(int argc, char **argv)
111 if (optind == argc) 111 if (optind == argc)
112 show_usage(); 112 show_usage();
113 113
114 time = askremotedate(argv[optind]); 114 remote_time = askremotedate(argv[optind]);
115 115
116 if (setdate) { 116 if (setdate) {
117 if (stime(&time) < 0) 117 if (stime(&remote_time) < 0)
118 perror_msg_and_die("Could not set time of day"); 118 perror_msg_and_die("Could not set time of day");
119 } 119 }
120 120
121 if (printdate) 121 if (printdate)
122 printf("%s", ctime(&time)); 122 printf("%s", ctime(&remote_time));
123 123
124 return EXIT_SUCCESS; 124 return EXIT_SUCCESS;
125} 125}
diff --git a/util-linux/umount.c b/util-linux/umount.c
index 2868a1bc3..cc7d38d7c 100644
--- a/util-linux/umount.c
+++ b/util-linux/umount.c
@@ -57,7 +57,9 @@ static int doForce = FALSE;
57#if defined BB_FEATURE_MOUNT_LOOP 57#if defined BB_FEATURE_MOUNT_LOOP
58static int freeLoop = TRUE; 58static int freeLoop = TRUE;
59#endif 59#endif
60#if defined BB_MTAB
60static int useMtab = TRUE; 61static int useMtab = TRUE;
62#endif
61static int umountAll = FALSE; 63static int umountAll = FALSE;
62static int doRemount = FALSE; 64static int doRemount = FALSE;
63extern const char mtab_file[]; /* Defined in utility.c */ 65extern const char mtab_file[]; /* Defined in utility.c */
@@ -162,7 +164,7 @@ void mtab_free(void)
162} 164}
163#endif 165#endif
164 166
165static int do_umount(const char *name, int useMtab) 167static int do_umount(const char *name)
166{ 168{
167 int status; 169 int status;
168 char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE); 170 char *blockDevice = mtab_getinfo(name, MTAB_GETDEVICE);
@@ -204,7 +206,7 @@ static int do_umount(const char *name, int useMtab)
204 return (FALSE); 206 return (FALSE);
205} 207}
206 208
207static int umount_all(int useMtab) 209static int umount_all(void)
208{ 210{
209 int status = TRUE; 211 int status = TRUE;
210 char *mountpt; 212 char *mountpt;
@@ -214,14 +216,14 @@ static int umount_all(int useMtab)
214 /* Never umount /proc on a umount -a */ 216 /* Never umount /proc on a umount -a */
215 if (strstr(mountpt, "proc")!= NULL) 217 if (strstr(mountpt, "proc")!= NULL)
216 continue; 218 continue;
217 if (!do_umount(mountpt, useMtab)) { 219 if (!do_umount(mountpt)) {
218 /* Don't bother retrying the umount on busy devices */ 220 /* Don't bother retrying the umount on busy devices */
219 if (errno == EBUSY) { 221 if (errno == EBUSY) {
220 perror_msg("%s", mountpt); 222 perror_msg("%s", mountpt);
221 status = FALSE; 223 status = FALSE;
222 continue; 224 continue;
223 } 225 }
224 if (!do_umount(mountpt, useMtab)) { 226 if (!do_umount(mountpt)) {
225 printf("Couldn't umount %s on %s: %s\n", 227 printf("Couldn't umount %s on %s: %s\n",
226 mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE), 228 mountpt, mtab_getinfo(mountpt, MTAB_GETDEVICE),
227 strerror(errno)); 229 strerror(errno));
@@ -275,12 +277,12 @@ extern int umount_main(int argc, char **argv)
275 277
276 mtab_read(); 278 mtab_read();
277 if (umountAll == TRUE) { 279 if (umountAll == TRUE) {
278 if (umount_all(useMtab) == TRUE) 280 if (umount_all() == TRUE)
279 return EXIT_SUCCESS; 281 return EXIT_SUCCESS;
280 else 282 else
281 return EXIT_FAILURE; 283 return EXIT_FAILURE;
282 } 284 }
283 if (do_umount(*argv, useMtab) == TRUE) 285 if (do_umount(*argv) == TRUE)
284 return EXIT_SUCCESS; 286 return EXIT_SUCCESS;
285 perror_msg_and_die("%s", *argv); 287 perror_msg_and_die("%s", *argv);
286} 288}