aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2013-01-08 21:14:25 -0500
committerTheodore Ts'o <tytso@mit.edu>2013-01-08 21:14:25 -0500
commitdf5e35fd63b42b66d5025fdca17bfdf6662a2827 (patch)
treecff4ded8da39520af2f874f7236811925e62281d
parent827f45243acc16d3d98332db39d5b4eeadf33a0f (diff)
parentda489dd2f3287b644c792c4e7ffb530a8ae0b9a2 (diff)
downloade2fsprogs-df5e35fd63b42b66d5025fdca17bfdf6662a2827.tar.gz
e2fsprogs-df5e35fd63b42b66d5025fdca17bfdf6662a2827.tar.xz
e2fsprogs-df5e35fd63b42b66d5025fdca17bfdf6662a2827.zip
Merge branch 'maint' into next
Conflicts: misc/mke2fs.c
-rwxr-xr-xconfig/parse-types.sh16
-rw-r--r--e2fsck/logfile.c18
-rw-r--r--e2fsck/unix.c2
-rw-r--r--e2fsck/util.c3
-rw-r--r--lib/ext2fs/openfs.c6
-rw-r--r--misc/mke2fs.c9
6 files changed, 35 insertions, 19 deletions
diff --git a/config/parse-types.sh b/config/parse-types.sh
index d7cb9cc1..c02d8cb9 100755
--- a/config/parse-types.sh
+++ b/config/parse-types.sh
@@ -31,7 +31,7 @@ main(int argc, char **argv)
#ifdef __U8_TYPEDEF
if (sizeof(__U8_TYPEDEF) != 1) {
printf("Sizeof(__U8__TYPEDEF) is %d should be 1\n",
- sizeof(__U8_TYPEDEF));
+ (int) sizeof(__U8_TYPEDEF));
exit(1);
}
#else
@@ -40,7 +40,7 @@ main(int argc, char **argv)
#ifdef __S8_TYPEDEF
if (sizeof(__S8_TYPEDEF) != 1) {
printf("Sizeof(_S8__TYPEDEF) is %d should be 1\n",
- sizeof(__S8_TYPEDEF));
+ (int) sizeof(__S8_TYPEDEF));
exit(1);
}
#else
@@ -49,7 +49,7 @@ main(int argc, char **argv)
#ifdef __U16_TYPEDEF
if (sizeof(__U16_TYPEDEF) != 2) {
printf("Sizeof(__U16__TYPEDEF) is %d should be 2\n",
- sizeof(__U16_TYPEDEF));
+ (int) sizeof(__U16_TYPEDEF));
exit(1);
}
#else
@@ -58,7 +58,7 @@ main(int argc, char **argv)
#ifdef __S16_TYPEDEF
if (sizeof(__S16_TYPEDEF) != 2) {
printf("Sizeof(__S16__TYPEDEF) is %d should be 2\n",
- sizeof(__S16_TYPEDEF));
+ (int) sizeof(__S16_TYPEDEF));
exit(1);
}
#else
@@ -68,7 +68,7 @@ main(int argc, char **argv)
#ifdef __U32_TYPEDEF
if (sizeof(__U32_TYPEDEF) != 4) {
printf("Sizeof(__U32__TYPEDEF) is %d should be 4\n",
- sizeof(__U32_TYPEDEF));
+ (int) sizeof(__U32_TYPEDEF));
exit(1);
}
#else
@@ -77,7 +77,7 @@ main(int argc, char **argv)
#ifdef __S32_TYPEDEF
if (sizeof(__S32_TYPEDEF) != 4) {
printf("Sizeof(__S32__TYPEDEF) is %d should be 4\n",
- sizeof(__S32_TYPEDEF));
+ (int) sizeof(__S32_TYPEDEF));
exit(1);
}
#else
@@ -87,7 +87,7 @@ main(int argc, char **argv)
#ifdef __U64_TYPEDEF
if (sizeof(__U64_TYPEDEF) != 8) {
printf("Sizeof(__U64__TYPEDEF) is %d should be 8\n",
- sizeof(__U64_TYPEDEF));
+ (int) sizeof(__U64_TYPEDEF));
exit(1);
}
#else
@@ -96,7 +96,7 @@ main(int argc, char **argv)
#ifdef __S64_TYPEDEF
if (sizeof(__S64_TYPEDEF) != 8) {
printf("Sizeof(__S64__TYPEDEF) is %d should be 8\n",
- sizeof(__S64_TYPEDEF));
+ (int) sizeof(__S64_TYPEDEF));
exit(1);
}
#else
diff --git a/e2fsck/logfile.c b/e2fsck/logfile.c
index 9229fbf9..c48b8eb8 100644
--- a/e2fsck/logfile.c
+++ b/e2fsck/logfile.c
@@ -36,19 +36,25 @@ static void alloc_string(struct string *s, int len)
static void append_string(struct string *s, const char *a, int len)
{
+ int needlen;
+
if (!len)
len = strlen(a);
- if (s->end + len >= s->len) {
- char *n = realloc(s, s->len * 2);
+ needlen = s->end + len + 1;
+ if (needlen > s->len) {
+ char *n;
+
+ if (s->len * 2 > needlen)
+ needlen = s->len * 2;
+ n = realloc(s->s, needlen);
if (n) {
s->s = n;
- s->len = s->len * 2;
+ s->len = needlen;
} else {
- len = s->len - s->end - 1;
- if (len <= 0)
- return;
+ /* Don't append if we ran out of memory */
+ return;
}
}
memcpy(s->s + s->end, a, len);
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index 9f16f01b..5b705ed6 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -1062,7 +1062,7 @@ static errcode_t try_open_fs(e2fsck_t ctx, int flags, io_manager io_ptr,
retval = ext2fs_open2(ctx->filesystem_name, ctx->io_options,
flags, 0, 0, io_ptr, ret_fs);
- if (ret_fs)
+ if (retval == 0)
e2fsck_set_bitmap_type(*ret_fs, EXT2FS_BMAP64_RBTREE,
"default", NULL);
return retval;
diff --git a/e2fsck/util.c b/e2fsck/util.c
index a4ec800a..9eaf5574 100644
--- a/e2fsck/util.c
+++ b/e2fsck/util.c
@@ -121,7 +121,8 @@ void *e2fsck_allocate_memory(e2fsck_t ctx, unsigned int size,
#endif
ret = malloc(size);
if (!ret) {
- sprintf(buf, "Can't allocate %s\n", description);
+ sprintf(buf, "Can't allocate %u bytes for %s\n",
+ size, description);
fatal_error(ctx, buf);
}
memset(ret, 0, size);
diff --git a/lib/ext2fs/openfs.c b/lib/ext2fs/openfs.c
index ea505c79..89117f43 100644
--- a/lib/ext2fs/openfs.c
+++ b/lib/ext2fs/openfs.c
@@ -417,9 +417,6 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
ext2fs_mark_super_dirty(fs);
}
- fs->flags &= ~EXT2_FLAG_NOFREE_ON_ERROR;
- *ret_fs = fs;
-
if ((fs->super->s_feature_incompat & EXT4_FEATURE_INCOMPAT_MMP) &&
!(flags & EXT2_FLAG_SKIP_MMP) &&
(flags & (EXT2_FLAG_RW | EXT2_FLAG_EXCLUSIVE))) {
@@ -431,6 +428,9 @@ errcode_t ext2fs_open2(const char *name, const char *io_options,
}
}
+ fs->flags &= ~EXT2_FLAG_NOFREE_ON_ERROR;
+ *ret_fs = fs;
+
return 0;
cleanup:
if (flags & EXT2_FLAG_NOFREE_ON_ERROR)
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 3bc4088a..8dd656c8 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -1998,6 +1998,15 @@ profile_error:
fs_param.s_feature_ro_compat &=
~EXT4_FEATURE_RO_COMPAT_GDT_CSUM;
+ /* Can't support bigalloc feature without extents feature */
+ if ((fs_param.s_feature_ro_compat & EXT4_FEATURE_RO_COMPAT_BIGALLOC) &&
+ !(fs_param.s_feature_incompat & EXT3_FEATURE_INCOMPAT_EXTENTS)) {
+ com_err(program_name, 0,
+ _("Can't support bigalloc feature without "
+ "extents feature"));
+ exit(1);
+ }
+
/* Since sparse_super is the default, we would only have a problem
* here if it was explicitly disabled.
*/