summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--debugfs/ChangeLog4
-rw-r--r--debugfs/debugfs.8.in14
-rw-r--r--debugfs/debugfs.c14
-rw-r--r--e2fsck/ChangeLog4
-rw-r--r--e2fsck/unix.c2
-rw-r--r--lib/ext2fs/ChangeLog7
-rw-r--r--lib/ext2fs/inode.c37
-rw-r--r--lib/uuid/ChangeLog5
-rw-r--r--lib/uuid/tst_uuid.c2
-rw-r--r--misc/ChangeLog19
-rw-r--r--misc/badblocks.c8
-rw-r--r--misc/chattr.c4
-rw-r--r--misc/dumpe2fs.c6
-rw-r--r--misc/fsck.c41
-rw-r--r--misc/lsattr.c8
-rw-r--r--misc/mke2fs.8.in8
-rw-r--r--misc/mke2fs.c9
-rw-r--r--misc/tune2fs.c69
-rw-r--r--tests/progs/ChangeLog5
-rw-r--r--tests/progs/test_icount.c7
20 files changed, 177 insertions, 96 deletions
diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog
index bac25361..55ed7c08 100644
--- a/debugfs/ChangeLog
+++ b/debugfs/ChangeLog
@@ -1,3 +1,7 @@
+1998-06-27 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * debugfs.c: Add a -V option which displays the current version.
+
1998-03-31 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Makefile.in: Change to use new installation directory variables
diff --git a/debugfs/debugfs.8.in b/debugfs/debugfs.8.in
index 0e81ca11..bc4928e9 100644
--- a/debugfs/debugfs.8.in
+++ b/debugfs/debugfs.8.in
@@ -8,9 +8,6 @@ debugfs \- ext2 file system debugger
.SH SYNOPSIS
.B debugfs
[
-.B \-w
-]
-[
.B \-f
cmd_file
]
@@ -19,8 +16,14 @@ cmd_file
request
]
[
+.B \-V
+]
+[
+.B \-w
+[
device
]
+]
.SH DESCRIPTION
The
.B debugfs
@@ -52,6 +55,11 @@ Causes
to execute the single command
.IR request ,
and then exit.
+.TP
+.I -V
+print the version number of
+.B debugfs
+and exit.
.SH COMMANDS
.B debugfs
is an interactive debugger. It understands a number of commands.
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 3c667955..2cbad64c 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -35,6 +35,8 @@ extern int optreset; /* defined by BSD, but not others */
#include "debugfs.h"
#include "uuid/uuid.h"
+#include "../version.h"
+
extern ss_request_table debug_cmds;
ext2_filsys current_fs = NULL;
@@ -1353,7 +1355,7 @@ int main(int argc, char **argv)
{
int retval;
int sci_idx;
- const char *usage = "Usage: debugfs [[-w] device]";
+ const char *usage = "Usage: debugfs [-f cmd_file] [-R request] [-V] [[-w] device]";
int c;
int open_flags = 0;
char *request = 0;
@@ -1361,8 +1363,11 @@ int main(int argc, char **argv)
char *cmd_file = 0;
initialize_ext2_error_table();
+ fprintf (stderr, "debugfs %s, %s for EXT2 FS %s, %s\n",
+ E2FSPROGS_VERSION, E2FSPROGS_DATE,
+ EXT2FS_VERSION, EXT2FS_DATE);
- while ((c = getopt (argc, argv, "wR:f:")) != EOF) {
+ while ((c = getopt (argc, argv, "wR:f:V")) != EOF) {
switch (c) {
case 'R':
request = optarg;
@@ -1373,6 +1378,11 @@ int main(int argc, char **argv)
case 'w':
open_flags = EXT2_FLAG_RW;
break;
+ case 'V':
+ /* Print version number and exit */
+ fprintf(stderr, "\tUsing %s\n",
+ error_message(EXT2_ET_BASE));
+ exit(0);
default:
com_err(argv[0], 0, usage);
return 1;
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index d9566f1a..61d9d114 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,3 +1,7 @@
+1998-06-25 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * unix.c (e2fsck_update_progress): Remove unused variables.
+
1998-06-10 Theodore Ts'o <tytso@rsts-11.mit.edu>
* pass1.c, problem.h: Change blkcnt_t to be e2_blkcnt_t to avoid
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index e674b71d..9ef7a1db 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -227,8 +227,6 @@ static int e2fsck_update_progress(e2fsck_t ctx, int pass,
unsigned long cur, unsigned long max)
{
const char spinner[] = "\\|/-";
- int percent;
- struct e2_progress_struct *prog_struct;
char buf[80];
if (ctx->progress_fd) {
diff --git a/lib/ext2fs/ChangeLog b/lib/ext2fs/ChangeLog
index ccb74d4e..6ed34976 100644
--- a/lib/ext2fs/ChangeLog
+++ b/lib/ext2fs/ChangeLog
@@ -1,3 +1,10 @@
+1998-06-18 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * inode.c (get_next_blockgroup): Fix bug where if
+ get_next_blockgroup() is called early because of a missing
+ inode table in a block group, the current_inode counter
+ wasn't incremented correctly.
+
1998-06-16 Theodore Ts'o <tytso@rsts-11.mit.edu>
* read_bb.c (ext2fs_read_bb_inode): Make function more robust
diff --git a/lib/ext2fs/inode.c b/lib/ext2fs/inode.c
index 0edee7f4..7c9c8bcd 100644
--- a/lib/ext2fs/inode.c
+++ b/lib/ext2fs/inode.c
@@ -210,6 +210,9 @@ static errcode_t get_next_blockgroup(ext2_inode_scan scan)
scan->current_block = scan->fs->
group_desc[scan->current_group].bg_inode_table;
+ scan->current_inode = scan->current_group *
+ EXT2_INODES_PER_GROUP(scan->fs->super);
+
scan->bytes_left = 0;
scan->inodes_left = EXT2_INODES_PER_GROUP(scan->fs->super);
scan->blocks_left = scan->fs->inode_blocks_per_group;
@@ -221,7 +224,6 @@ errcode_t ext2fs_inode_scan_goto_blockgroup(ext2_inode_scan scan,
{
scan->current_group = group - 1;
scan->groups_left = scan->fs->group_desc_count - group;
- scan->current_inode = group * EXT2_INODES_PER_GROUP(scan->fs->super);
return get_next_blockgroup(scan);
}
@@ -344,6 +346,27 @@ static errcode_t get_next_blocks(ext2_inode_scan scan)
return 0;
}
+#if 0
+/*
+ * Returns 1 if the entire inode_buffer has a non-zero size and
+ * contains all zeros. (Not just deleted inodes, since that means
+ * that part of the inode table was used at one point; we want all
+ * zeros, which means that the inode table is pristine.)
+ */
+static inline int is_empty_scan(ext2_inode_scan scan)
+{
+ int i;
+
+ if (scan->bytes_left == 0)
+ return 0;
+
+ for (i=0; i < scan->bytes_left; i++)
+ if (scan->ptr[i])
+ return 0;
+ return 1;
+}
+#endif
+
errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
struct ext2_inode *inode)
{
@@ -356,7 +379,7 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
* Do we need to start reading a new block group?
*/
if (scan->inodes_left <= 0) {
- retry:
+ force_new_group:
if (scan->done_group) {
retval = (scan->done_group)
(scan->fs, scan, scan->current_group,
@@ -378,7 +401,7 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
*/
if (scan->current_block == 0) {
if (scan->scan_flags & EXT2_SF_SKIP_MISSING_ITABLE) {
- goto retry;
+ goto force_new_group;
} else
return EXT2_ET_MISSING_INODE_TABLE;
}
@@ -395,6 +418,14 @@ errcode_t ext2fs_get_next_inode(ext2_inode_scan scan, ino_t *ino,
retval = get_next_blocks(scan);
if (retval)
return retval;
+#if 0
+ /*
+ * XXX test Need check for used inode somehow.
+ * (Note: this is hard.)
+ */
+ if (is_empty_scan(scan))
+ goto force_new_group;
+#endif
}
retval = 0;
diff --git a/lib/uuid/ChangeLog b/lib/uuid/ChangeLog
index 9e9a4e0d..e837f5e2 100644
--- a/lib/uuid/ChangeLog
+++ b/lib/uuid/ChangeLog
@@ -1,3 +1,8 @@
+1998-06-25 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * tst_uuid.c (main): Fixed bogus declaration of the main's argv
+ parameter.
+
1998-04-26 Theodore Ts'o <tytso@rsts-11.mit.edu>
* uuidP.h: Use asm/types.h instead of linux/types.h to avoid a
diff --git a/lib/uuid/tst_uuid.c b/lib/uuid/tst_uuid.c
index c60e9f81..c474af74 100644
--- a/lib/uuid/tst_uuid.c
+++ b/lib/uuid/tst_uuid.c
@@ -15,7 +15,7 @@
#include "uuid.h"
int
-main(int argc, char *argv)
+main(int argc, char **argv)
{
uuid_t buf, tst;
char str[100];
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 9500526b..5868c97c 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,3 +1,22 @@
+1998-06-25 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * fsck.c (ignore): Remove unused variable cp.
+
+ * chattr.c (fatal_error):
+ * tune2fs.c (usage):
+ * lsattr.c (usage):
+ * dumpe2fs.c (usage):
+ * badblocks.c (usage): Remove volatile from declaration.
+
+ * fsck.c: Change use of strdup to be string_copy, since we don't
+ trust what glibc is doing with strdup. (Whatever it is,
+ it isn't pretty.)
+
+1998-06-19 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * mke2fs.c (PRS): Add a -V option which prints the version number
+ and exit.
+
1998-05-14 Theodore Ts'o <tytso@rsts-11.mit.edu>
* fsck.c (ignore): Remove check for filesystems with the noauto
diff --git a/misc/badblocks.c b/misc/badblocks.c
index 81dc891e..f9551938 100644
--- a/misc/badblocks.c
+++ b/misc/badblocks.c
@@ -50,7 +50,7 @@ int v_flag = 0; /* verbose */
int w_flag = 0; /* do r/w test */
int s_flag = 0; /* show progress of test */
-static volatile void usage (void)
+static void usage(void)
{
fprintf (stderr, "Usage: %s [-b block_size] [-o output_file] [-svw] device blocks_count\n [start_count]\n",
program_name);
@@ -298,14 +298,14 @@ int main (int argc, char ** argv)
w_flag = 1;
break;
default:
- usage ();
+ usage();
}
}
if (optind > argc - 1)
- usage ();
+ usage();
device_name = argv[optind++];
if (optind > argc - 1)
- usage ();
+ usage();
blocks_count = strtoul (argv[optind], &tmp, 0);
if (*tmp)
{
diff --git a/misc/chattr.c b/misc/chattr.c
index 7f40f885..c8c92453 100644
--- a/misc/chattr.c
+++ b/misc/chattr.c
@@ -51,13 +51,13 @@ unsigned long af;
unsigned long rf;
unsigned long sf;
-static void volatile fatal_error (const char * fmt_string, int errcode)
+static void fatal_error(const char * fmt_string, int errcode)
{
fprintf (stderr, fmt_string, program_name);
exit (errcode);
}
-#define usage() fatal_error ("usage: %s [-RV] [-+=AacdisSu] [-v version] files...\n", \
+#define usage() fatal_error("usage: %s [-RV] [-+=AacdisSu] [-v version] files...\n", \
1)
static int decode_arg (int * i, int argc, char ** argv)
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index e8c6b8de..a0908478 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -41,7 +41,7 @@
const char * program_name = "dumpe2fs";
char * device_name = NULL;
-static volatile void usage (void)
+static void usage(void)
{
fprintf (stderr, "usage: %s [-bV] device\n", program_name);
exit (1);
@@ -198,11 +198,11 @@ int main (int argc, char ** argv)
error_message(EXT2_ET_BASE));
exit(0);
default:
- usage ();
+ usage();
}
}
if (optind > argc - 1)
- usage ();
+ usage();
device_name = argv[optind++];
retval = ext2fs_open (device_name, 0, 0, 0, unix_io_manager, &fs);
if (retval) {
diff --git a/misc/fsck.c b/misc/fsck.c
index 29c87413..c30997e1 100644
--- a/misc/fsck.c
+++ b/misc/fsck.c
@@ -133,12 +133,7 @@ const char *fsck_prefix_path = "/sbin:/sbin/fs.d:/sbin/fs:/etc/fs:/etc";
char *fsck_path = 0;
static int ignore(struct fs_info *);
-#ifdef HAVE_STRDUP
-#ifdef _POSIX_SOURCE
-extern char *strdup(const char *s);
-#endif
-#else
-static char *strdup(const char *s)
+static char *string_copy(const char *s)
{
char *ret;
@@ -147,7 +142,6 @@ static char *strdup(const char *s)
strcpy(ret, s);
return ret;
}
-#endif
static void free_instance(struct fsck_instance *i)
{
@@ -182,10 +176,10 @@ static void load_fs_info(NOARGS)
while ((mp = getmntent(mntfile)) != NULL) {
fs = malloc(sizeof(struct fs_info));
memset(fs, 0, sizeof(struct fs_info));
- fs->device = strdup(mp->mnt_fsname);
- fs->mountpt = strdup(mp->mnt_dir);
- fs->type = strdup(mp->mnt_type);
- fs->opts = strdup(mp->mnt_opts);
+ fs->device = string_copy(mp->mnt_fsname);
+ fs->mountpt = string_copy(mp->mnt_dir);
+ fs->type = string_copy(mp->mnt_type);
+ fs->opts = string_copy(mp->mnt_opts);
fs->freq = mp->mnt_freq;
fs->passno = mp->mnt_passno;
fs->next = NULL;
@@ -241,7 +235,7 @@ static char *find_fsck(char *type)
char *s;
const char *tpl;
static char prog[256];
- char *p = strdup(fsck_path);
+ char *p = string_copy(fsck_path);
struct stat st;
/* Are we looking for a program or just a type? */
@@ -266,13 +260,13 @@ static int execute(char *prog, char *device)
struct fsck_instance *inst;
pid_t pid;
- argv[0] = strdup(prog);
+ argv[0] = string_copy(prog);
argc = 1;
for (i=0; i <num_args; i++)
- argv[argc++] = strdup(args[i]);
+ argv[argc++] = string_copy(args[i]);
- argv[argc++] = strdup(device);
+ argv[argc++] = string_copy(device);
argv[argc] = 0;
s = find_fsck(prog);
@@ -304,8 +298,8 @@ static int execute(char *prog, char *device)
return ENOMEM;
memset(inst, 0, sizeof(struct fsck_instance));
inst->pid = pid;
- inst->prog = strdup(prog);
- inst->device = strdup(device);
+ inst->prog = string_copy(prog);
+ inst->device = string_copy(device);
inst->next = instance_list;
instance_list = inst;
@@ -460,7 +454,6 @@ static int fs_match(char *type, char *fs_type)
/* Check if we should ignore this filesystem. */
static int ignore(struct fs_info *fs)
{
- const char *cp;
const char **ip;
int wanted = 0;
@@ -661,7 +654,7 @@ static void PRS(int argc, char *argv[])
progname);
exit(1);
}
- devices[num_devices++] = strdup(arg);
+ devices[num_devices++] = string_copy(arg);
continue;
}
if (arg[0] != '-') {
@@ -670,7 +663,7 @@ static void PRS(int argc, char *argv[])
progname);
exit(1);
}
- args[num_args++] = strdup(arg);
+ args[num_args++] = string_copy(arg);
continue;
}
for (j=1; arg[j]; j++) {
@@ -705,12 +698,12 @@ static void PRS(int argc, char *argv[])
break;
case 't':
if (arg[j+1]) {
- fstype = strdup(arg+j+1);
+ fstype = string_copy(arg+j+1);
goto next_arg;
}
if ((i+1) < argc) {
i++;
- fstype = strdup(argv[i]);
+ fstype = string_copy(argv[i]);
goto next_arg;
}
usage();
@@ -733,7 +726,7 @@ static void PRS(int argc, char *argv[])
progname);
exit(1);
}
- args[num_args++] = strdup(options);
+ args[num_args++] = string_copy(options);
opt = 0;
}
}
@@ -759,7 +752,7 @@ int main(int argc, char *argv[])
strcat (fsck_path, ":");
strcat (fsck_path, oldpath);
} else {
- fsck_path = strdup(fsck_prefix_path);
+ fsck_path = string_copy(fsck_prefix_path);
}
/* If -A was specified ("check all"), do that! */
diff --git a/misc/lsattr.c b/misc/lsattr.c
index 839df0fd..73823cce 100644
--- a/misc/lsattr.c
+++ b/misc/lsattr.c
@@ -49,10 +49,10 @@ int l_opt = 0;
int recursive = 0;
int v_opt = 0;
-static void volatile usage (void)
+static void usage(void)
{
- fprintf (stderr, "Usage: %s [-Radlv] [files...]\n", program_name);
- exit (1);
+ fprintf(stderr, "Usage: %s [-Radlv] [files...]\n", program_name);
+ exit(1);
}
static void list_attributes (const char * name)
@@ -148,7 +148,7 @@ int main (int argc, char ** argv)
v_opt = 1;
break;
default:
- usage ();
+ usage();
}
if (optind > argc - 1)
diff --git a/misc/mke2fs.8.in b/misc/mke2fs.8.in
index 6bb5877e..7b109373 100644
--- a/misc/mke2fs.8.in
+++ b/misc/mke2fs.8.in
@@ -65,6 +65,9 @@ mke2fs \- create a Linux second extended file system
[
.B \-S
]
+[
+.B \-V
+]
.I device
[
.I blocks-count
@@ -175,6 +178,11 @@ and the block and inode bitmaps. The
.B e2fsck
program should be run immediately after this option is used, and there
is no guarantee that any data will be salvageable.
+.TP
+.I -V
+print the version number of
+.B mke2fs
+and exit.
.SH AUTHOR
This version of
.B mke2fs
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 0ec17ba1..5eacdad7 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -88,7 +88,7 @@ static void usage(NOARGS)
{
fprintf(stderr, "Usage: %s [-c|-t|-l filename] [-b block-size] "
"[-f fragment-size]\n\t[-i bytes-per-inode] "
- "[-m reserved-blocks-percentage] [-qvS]\n\t"
+ "[-m reserved-blocks-percentage] [-qvSV]\n\t"
"[-o creator-os] [-g blocks-per-group] [-L volume-label]\n\t"
"[-M last-mounted-directory] [-r fs-revision] [-R raid_opts]\n\t"
"device [blocks-count]\n",
@@ -636,7 +636,7 @@ static void PRS(int argc, char *argv[])
if (argc && *argv)
program_name = *argv;
while ((c = getopt (argc, argv,
- "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:")) != EOF)
+ "b:cf:g:i:l:m:o:qr:R:s:tvI:SFL:M:V")) != EOF)
switch (c) {
case 'b':
size = strtoul(optarg, &tmp, 0);
@@ -740,6 +740,11 @@ static void PRS(int argc, char *argv[])
case 'S':
super_only = 1;
break;
+ case 'V':
+ /* Print version number and exit */
+ fprintf(stderr, "\tUsing %s\n",
+ error_message(EXT2_ET_BASE));
+ exit(0);
default:
usage();
}
diff --git a/misc/tune2fs.c b/misc/tune2fs.c
index a82ed5ca..b5582a5c 100644
--- a/misc/tune2fs.c
+++ b/misc/tune2fs.c
@@ -90,9 +90,9 @@ static int strcasecmp (char *s1, char *s2)
}
#endif
-static volatile void usage (void)
+static void usage(void)
{
- fprintf (stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] "
+ fprintf(stderr, "Usage: %s [-c max-mounts-count] [-e errors-behavior] "
"[-g group]\n"
"\t[-i interval[d|m|w]] [-l] [-s] [-m reserved-blocks-percent]\n"
"\t[-r reserved-blocks-count] [-u user] [-C mount-count]\n"
@@ -123,24 +123,22 @@ int main (int argc, char ** argv)
{
case 'c':
max_mount_count = strtoul (optarg, &tmp, 0);
- if (*tmp || max_mount_count > 16000)
- {
+ if (*tmp || max_mount_count > 16000) {
com_err (program_name, 0,
"bad mounts count - %s",
optarg);
- usage ();
+ usage();
}
c_flag = 1;
open_flag = EXT2_FLAG_RW;
break;
case 'C':
mount_count = strtoul (optarg, &tmp, 0);
- if (*tmp || mount_count > 16000)
- {
+ if (*tmp || mount_count > 16000) {
com_err (program_name, 0,
"bad mounts count - %s",
optarg);
- usage ();
+ usage();
}
C_flag = 1;
open_flag = EXT2_FLAG_RW;
@@ -152,20 +150,18 @@ int main (int argc, char ** argv)
errors = EXT2_ERRORS_RO;
else if (strcmp (optarg, "panic") == 0)
errors = EXT2_ERRORS_PANIC;
- else
- {
+ else {
com_err (program_name, 0,
"bad error behavior - %s",
optarg);
- usage ();
+ usage();
}
e_flag = 1;
open_flag = EXT2_FLAG_RW;
break;
case 'g':
resgid = strtoul (optarg, &tmp, 0);
- if (*tmp)
- {
+ if (*tmp) {
gr = getgrnam (optarg);
if (gr == NULL)
tmp = optarg;
@@ -174,12 +170,11 @@ int main (int argc, char ** argv)
*tmp =0;
}
}
- if (*tmp)
- {
+ if (*tmp) {
com_err (program_name, 0,
"bad gid/group name - %s",
optarg);
- usage ();
+ usage();
}
g_flag = 1;
open_flag = EXT2_FLAG_RW;
@@ -208,11 +203,10 @@ int main (int argc, char ** argv)
tmp++;
break;
}
- if (*tmp || interval > (365 * 86400))
- {
+ if (*tmp || interval > (365 * 86400)) {
com_err (program_name, 0,
"bad interval - %s", optarg);
- usage ();
+ usage();
}
i_flag = 1;
open_flag = EXT2_FLAG_RW;
@@ -227,12 +221,11 @@ int main (int argc, char ** argv)
break;
case 'm':
reserved_ratio = strtoul (optarg, &tmp, 0);
- if (*tmp || reserved_ratio > 50)
- {
+ if (*tmp || reserved_ratio > 50) {
com_err (program_name, 0,
"bad reserved block ratio - %s",
optarg);
- usage ();
+ usage();
}
m_flag = 1;
open_flag = EXT2_FLAG_RW;
@@ -244,12 +237,11 @@ int main (int argc, char ** argv)
break;
case 'r':
reserved_blocks = strtoul (optarg, &tmp, 0);
- if (*tmp)
- {
+ if (*tmp) {
com_err (program_name, 0,
"bad reserved blocks count - %s",
optarg);
- usage ();
+ usage();
}
r_flag = 1;
open_flag = EXT2_FLAG_RW;
@@ -260,8 +252,7 @@ int main (int argc, char ** argv)
break;
case 'u':
resuid = strtoul (optarg, &tmp, 0);
- if (*tmp)
- {
+ if (*tmp) {
pw = getpwnam (optarg);
if (pw == NULL)
tmp = optarg;
@@ -270,12 +261,11 @@ int main (int argc, char ** argv)
*tmp = 0;
}
}
- if (*tmp)
- {
+ if (*tmp) {
com_err (program_name, 0,
"bad uid/user name - %s",
optarg);
- usage ();
+ usage();
}
u_flag = 1;
open_flag = EXT2_FLAG_RW;
@@ -286,17 +276,16 @@ int main (int argc, char ** argv)
open_flag = EXT2_FLAG_RW;
break;
default:
- usage ();
+ usage();
}
if (optind < argc - 1 || optind == argc)
- usage ();
+ usage();
if (!open_flag && !l_flag)
usage();
device_name = argv[optind];
retval = ext2fs_open (device_name, open_flag, 0, 0,
unix_io_manager, &fs);
- if (retval)
- {
+ if (retval) {
com_err (program_name, retval, "while trying to open %s",
device_name);
printf("Couldn't find valid filesystem superblock.\n");
@@ -332,24 +321,20 @@ int main (int argc, char ** argv)
"The -g option is not supported by this version -- "
"Recompile with a newer kernel");
#endif
- if (i_flag)
- {
+ if (i_flag) {
fs->super->s_checkinterval = interval;
ext2fs_mark_super_dirty(fs);
printf ("Setting interval between check %lu seconds\n", interval);
}
- if (m_flag)
- {
+ if (m_flag) {
fs->super->s_r_blocks_count = (fs->super->s_blocks_count / 100)
* reserved_ratio;
ext2fs_mark_super_dirty(fs);
printf ("Setting reserved blocks percentage to %lu (%u blocks)\n",
reserved_ratio, fs->super->s_r_blocks_count);
}
- if (r_flag)
- {
- if (reserved_blocks >= fs->super->s_blocks_count)
- {
+ if (r_flag) {
+ if (reserved_blocks >= fs->super->s_blocks_count) {
com_err (program_name, 0,
"reserved blocks count is too big (%ul)",
reserved_blocks);
diff --git a/tests/progs/ChangeLog b/tests/progs/ChangeLog
index cdb19ce2..6ab454b9 100644
--- a/tests/progs/ChangeLog
+++ b/tests/progs/ChangeLog
@@ -1,3 +1,8 @@
+1998-06-25 Theodore Ts'o <tytso@rsts-11.mit.edu>
+
+ * test_icount.c (main): Fix main() declaration so that it returns
+ int, not void.
+
1998-03-31 Theodore Ts'o <tytso@rsts-11.mit.edu>
* Makefile.in: Add uninstall target (which is a just a no-op).
diff --git a/tests/progs/test_icount.c b/tests/progs/test_icount.c
index 53cc4209..896ded9c 100644
--- a/tests/progs/test_icount.c
+++ b/tests/progs/test_icount.c
@@ -290,7 +290,7 @@ static int source_file(const char *cmd_file, int sci_idx)
return exit_status;
}
-void main(int argc, char **argv)
+int main(int argc, char **argv)
{
int retval;
int sci_idx;
@@ -326,7 +326,7 @@ void main(int argc, char **argv)
break;
default:
com_err(argv[0], 0, usage);
- return;
+ exit(1);
}
}
sci_idx = ss_create_invocation("test_icount", "0.0", (char *) NULL,
@@ -354,6 +354,5 @@ void main(int argc, char **argv)
ss_listen(sci_idx);
}
- exit(exit_status);
+ return(exit_status);
}
-