Fix gcc -Wall nits.
Fix format bug if NLS is in use.
Add extra so that the info directory looks OK on OpenWall.
diff --git a/misc/ChangeLog b/misc/ChangeLog
index d940c51..63351a1 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,3 +1,11 @@
+2002-10-13 Theodore Ts'o <tytso@mit.edu>
+
+ * get_device_by_label.c (read_partitions): Use a 16k buffer to
+ read in /proc/partitions in one go.
+
+ * badblocks.c, fsck.c, fstype.c, get_device_by_label.c,
+ tune2fs.c: Fix gcc -Wall nits.
+
2002-10-11 Theodore Ts'o <tytso@mit.edu>
* mklost+found.c (main): Make sure the lost+found directory is
diff --git a/misc/badblocks.c b/misc/badblocks.c
index 8840d9b..c6e308e 100644
--- a/misc/badblocks.c
+++ b/misc/badblocks.c
@@ -785,7 +785,7 @@
}
} else
host_dev = dev;
- if (input_file)
+ if (input_file) {
if (strcmp (input_file, "-") == 0)
in = stdin;
else {
@@ -798,6 +798,7 @@
exit (1);
}
}
+ }
if (output_file && strcmp (output_file, "-") != 0)
{
out = fopen (output_file, "w");
diff --git a/misc/fsck.c b/misc/fsck.c
index e4c19a3..7393927 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -472,7 +472,7 @@
/*
* Send a signal to all outstanding fsck child processes
*/
-static int kill_all(int signal)
+static int kill_all(int signum)
{
struct fsck_instance *inst;
int n = 0;
@@ -480,7 +480,7 @@
for (inst = instance_list; inst; inst = inst->next) {
if (inst->flags & FLAG_DONE)
continue;
- kill(inst->pid, signal);
+ kill(inst->pid, signum);
n++;
}
return n;
@@ -886,7 +886,6 @@
static int check_all(NOARGS)
{
struct fs_info *fs = NULL;
- struct fsck_instance *inst;
int status = EXIT_OK;
int not_done_yet = 1;
int passno = 1;
diff --git a/misc/fstype.c b/misc/fstype.c
index 783ef65..8b5f9aa 100644
--- a/misc/fstype.c
+++ b/misc/fstype.c
@@ -10,6 +10,7 @@
*/
#include <stdio.h>
+#include <stdlib.h>
#include <string.h>
#if HAVE_UNISTD_H
#include <unistd.h>
diff --git a/misc/get_device_by_label.c b/misc/get_device_by_label.c
index 95cd28c..a80bfbc 100644
--- a/misc/get_device_by_label.c
+++ b/misc/get_device_by_label.c
@@ -166,6 +166,8 @@
return 0;
}
+#define CBBUF (16 * 1024)
+
static void
uuidcache_addentry(char *device, char *label, char *uuid) {
struct uuidCache_s *last;
@@ -257,11 +259,16 @@
struct stat statbuf;
int firstPass;
int handleOnFirst;
+ char *iobuf;
procpt = fopen(PROC_PARTITIONS, "r");
if (!procpt)
return;
+ iobuf = (char *)malloc(CBBUF);
+ if (iobuf)
+ setvbuf(procpt, iobuf, _IOFBF, CBBUF);
+
for (firstPass = 1; firstPass >= 0; firstPass--) {
fseek(procpt, 0, SEEK_SET);
@@ -313,13 +320,14 @@
}
fclose(procpt);
+ if (iobuf)
+ free(iobuf);
}
static void
read_evms(void)
{
char line[100];
- char *s;
int ma, mi, sz;
FILE *procpt;
char uuid[16], *label, *devname;
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index 9a8801b..2ea7abb 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -72,6 +72,8 @@
static const char *please_fsck = N_("Please run e2fsck on the filesystem.\n");
+void do_findfs(int argc, char **argv);
+
static void usage(void)
{
fprintf(stderr,
@@ -640,7 +642,7 @@
device_name = argv[optind];
}
-do_findfs(int argc, char **argv)
+void do_findfs(int argc, char **argv)
{
char *dev;