summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>2009-09-07 17:02:35 -0400
committerTheodore Ts'o <tytso@mit.edu>2009-09-07 17:02:35 -0400
commitdc615a21c3c43cd9071926df2633d5b23e2e726b (patch)
tree2dec30720078a57ca347bc1214aabea4476f7107 /lib
parenta9e55a1191cf08fd219466009613ed1a04bbaac0 (diff)
parent51e64594919c986f87267b895504322a38ec4fac (diff)
downloade2fsprogs-dc615a21c3c43cd9071926df2633d5b23e2e726b.tar.gz
Merge branch 'maint' into next
Diffstat (limited to 'lib')
-rw-r--r--lib/blkid/probe.c17
-rw-r--r--lib/ext2fs/gen_bitmap.c2
-rw-r--r--lib/ext2fs/mkjournal.c20
3 files changed, 26 insertions, 13 deletions
diff --git a/lib/blkid/probe.c b/lib/blkid/probe.c
index 8f6cfa6a..6b75732e 100644
--- a/lib/blkid/probe.c
+++ b/lib/blkid/probe.c
@@ -208,8 +208,8 @@ static int check_for_modules(const char *fs_name)
#ifdef __linux__
struct utsname uts;
FILE *f;
- char buf[1024], *cp, *t;
- int i;
+ char buf[1024], *cp;
+ int namesz;
if (uname(&uts))
return (0);
@@ -218,6 +218,9 @@ static int check_for_modules(const char *fs_name)
f = fopen(buf, "r");
if (!f)
return (0);
+
+ namesz = strlen(fs_name);
+
while (!feof(f)) {
if (!fgets(buf, sizeof(buf), f))
break;
@@ -229,13 +232,9 @@ static int check_for_modules(const char *fs_name)
cp++;
else
cp = buf;
- i = strlen(cp);
- if (i > 3) {
- t = cp + i - 3;
- if (!strcmp(t, ".ko"))
- *t = 0;
- }
- if (!strcmp(cp, fs_name)) {
+ if (!strncmp(cp, fs_name, namesz) &&
+ (!strcmp(cp + namesz, ".ko") ||
+ !strcmp(cp + namesz, ".ko.gz"))) {
fclose(f);
return (1);
}
diff --git a/lib/ext2fs/gen_bitmap.c b/lib/ext2fs/gen_bitmap.c
index ed3afef4..d6deafb1 100644
--- a/lib/ext2fs/gen_bitmap.c
+++ b/lib/ext2fs/gen_bitmap.c
@@ -103,6 +103,8 @@ errcode_t ext2fs_make_generic_bitmap(errcode_t magic, ext2_filsys fs,
bitmap->description = 0;
size = (size_t) (((bitmap->real_end - bitmap->start) / 8) + 1);
+ /* Round up to allow for the BT x86 instruction */
+ size = (size + 7) & ~3;
retval = ext2fs_get_mem(size, &bitmap->bitmap);
if (retval) {
ext2fs_free_mem(&bitmap->description);
diff --git a/lib/ext2fs/mkjournal.c b/lib/ext2fs/mkjournal.c
index 79e849ee..2f58466f 100644
--- a/lib/ext2fs/mkjournal.c
+++ b/lib/ext2fs/mkjournal.c
@@ -506,21 +506,33 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
goto errout;
/* Get inode number of the journal file */
- if (fstat(fd, &st) < 0)
+ if (fstat(fd, &st) < 0) {
+ retval = errno;
goto errout;
+ }
#if defined(HAVE_CHFLAGS) && defined(UF_NODUMP)
retval = fchflags (fd, UF_NODUMP|UF_IMMUTABLE);
#else
#if HAVE_EXT2_IOCTLS
- f = EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL;
+ if (ioctl(fd, EXT2_IOC_GETFLAGS, &f) < 0) {
+ retval = errno;
+ goto errout;
+ }
+ f |= EXT2_NODUMP_FL | EXT2_IMMUTABLE_FL;
retval = ioctl(fd, EXT2_IOC_SETFLAGS, &f);
#endif
#endif
- if (retval)
+ if (retval) {
+ retval = errno;
goto errout;
+ }
- close(fd);
+ if (close(fd) < 0) {
+ retval = errno;
+ fd = -1;
+ goto errout;
+ }
journal_ino = st.st_ino;
} else {
if ((mount_flags & EXT2_MF_BUSY) &&