mirror of https://github.com/vitalif/e2fsprogs
mkjournal.c (ext2fs_add_journal_inode): Move close of file
descriptor so that adding a journal to a mounted filesystem doesn't die. (Fixes a bug accidentally introduced in e2fsprogs 1.21.)bitmap-optimize
parent
7833262585
commit
b23520d050
|
@ -1,5 +1,10 @@
|
||||||
2001-06-22 Theodore Tso <tytso@valinux.com>
|
2001-06-22 Theodore Tso <tytso@valinux.com>
|
||||||
|
|
||||||
|
* mkjournal.c (ext2fs_add_journal_inode): Move close of file
|
||||||
|
descriptor so that adding a journal to a mounted
|
||||||
|
filesystem doesn't die. (Fixes a bug accidentally
|
||||||
|
introduced in e2fsprogs 1.21.)
|
||||||
|
|
||||||
* mkjournal.c (ext2fs_add_journal_inode): Only use fchflags if
|
* mkjournal.c (ext2fs_add_journal_inode): Only use fchflags if
|
||||||
HAVE_CHFLAGS and UF_NODUMP are defined, since the Hurd has
|
HAVE_CHFLAGS and UF_NODUMP are defined, since the Hurd has
|
||||||
fchflags without defining UF_NODUMP. (Addresses Debian
|
fchflags without defining UF_NODUMP. (Addresses Debian
|
||||||
|
|
|
@ -321,14 +321,13 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
|
||||||
/* Create the journal file */
|
/* Create the journal file */
|
||||||
if ((fd = open(jfile, O_CREAT|O_WRONLY, 0600)) < 0)
|
if ((fd = open(jfile, O_CREAT|O_WRONLY, 0600)) < 0)
|
||||||
return errno;
|
return errno;
|
||||||
close(fd);
|
|
||||||
|
|
||||||
if ((retval = write_journal_file(fs, jfile, size, flags)))
|
if ((retval = write_journal_file(fs, jfile, size, flags)))
|
||||||
return retval;
|
goto errout;
|
||||||
|
|
||||||
/* Get inode number of the journal file */
|
/* Get inode number of the journal file */
|
||||||
if (fstat(fd, &st) < 0)
|
if (fstat(fd, &st) < 0)
|
||||||
return errno;
|
goto errout;
|
||||||
|
|
||||||
#if defined(HAVE_CHFLAGS) && defined(UF_NODUMP)
|
#if defined(HAVE_CHFLAGS) && defined(UF_NODUMP)
|
||||||
retval = fchflags (fd, UF_NODUMP|UF_IMMUTABLE);
|
retval = fchflags (fd, UF_NODUMP|UF_IMMUTABLE);
|
||||||
|
@ -339,8 +338,9 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
|
||||||
#endif
|
#endif
|
||||||
#endif
|
#endif
|
||||||
if (retval)
|
if (retval)
|
||||||
return retval;
|
goto errout;
|
||||||
|
|
||||||
|
close(fd);
|
||||||
journal_ino = st.st_ino;
|
journal_ino = st.st_ino;
|
||||||
} else {
|
} else {
|
||||||
journal_ino = EXT2_JOURNAL_INO;
|
journal_ino = EXT2_JOURNAL_INO;
|
||||||
|
@ -357,6 +357,9 @@ errcode_t ext2fs_add_journal_inode(ext2_filsys fs, blk_t size, int flags)
|
||||||
|
|
||||||
ext2fs_mark_super_dirty(fs);
|
ext2fs_mark_super_dirty(fs);
|
||||||
return 0;
|
return 0;
|
||||||
|
errout:
|
||||||
|
close(fd);
|
||||||
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
Loading…
Reference in New Issue