Commit Graph

12 Commits (master)

Author SHA1 Message Date
Lukas Czerner 47fee2ef6a e2fsprogs: introduce ext2fs_close_free() helper
Currently there are many uses of ext2fs_close() which might be wrong.
First of all ext2fs_close() does not set the ext2_filsys pointer to NULL
so the caller is responsible for clearing it, however there are some
cases there we do not do it.

Second of all very small number of users of ext2fs_close() actually
check the return value. If there is a problem in ext2fs_close() it will
not even free the ext2_filsys structure, but majority of users expect it
to do so.

To fix both problems this commit introduces a new helper
ext2fs_close_free() which will not only check for the return value and
free the ext2_filsys structure if the call to ext2fs_close2() failed,
but it will also set the ext2_filsys pointer to NULL.

Replace every use of ext2fs_close() in e2fsprogs tools with
ext2fs_close_free() - there is no real reason to keep using
ext2fs_close().

Signed-off-by: Lukas Czerner <lczerner@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
Reviewed-by: Darrick J. Wong <darrick.wong@oracle.com>
2014-07-05 21:06:48 -04:00
Theodore Ts'o b24efa2187 Don't assume that the presence of mntent.h means that setmntent() exists
Change autoconf to test for setmntent() and use that to decide whether
to use getmntent() and setmntent(), since some systems don't have
setmntent() but they do have the mntent.h header file.

Also, remove the includes of mntent.h from e2fsck and mke2fs and other
places where it is not needed.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-04-05 15:31:09 -07:00
Theodore Ts'o d1154eb460 Shorten compile commands run by the build system
The DEFS line in MCONFIG had gotten so long that it exceeded 4k, and
this was starting to cause some tools heartburn.  It also made "make
V=1" almost useless, since trying to following the individual commands
run by make was lost in the noise of all of the defines.

So fix this by putting the configure-generated defines in lib/config.h
and the directory pathnames to lib/dirpaths.h.

In addition, clean up some vestigal defines in configure.in and in the
Makefiles to further shorten the cc command lines.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-09-18 17:34:37 -04:00
Theodore Ts'o efc6f628e1 Remove trailing whitespace for the entire source tree
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-08-27 23:07:54 -04:00
Theodore Ts'o e71d87317a Add Apple/Darwin patches. 2003-03-14 02:13:48 -05:00
Theodore Ts'o 54c637d4d2 Many files:
badblocks.c, chattr.c, dumpe2fs.c, e2image.c, findsuper.c, lsattr.c,
  	mke2fs.c, mklost+found.c, tune2fs.c, util.c: Change location of
  	ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, resize2fs.h:
  resize2fs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, debugfs.h:
  debugfs.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, e2fsck.h, scantest.c:
  e2fsck.h, scantest.c: Change location of ext2_fs.h to be
  	ext2fs/ext2_fs.h
ChangeLog, Makefile.in, tst_uuid.c, uuid_time.c:
  tst_uuid.c, uuid_time.c: Remove unneeded #include of ext2_fs.h
ChangeLog, Makefile.in, e2p.h:
  e2p.h: Change location of ext2_fs.h to be ext2fs/ext2_fs.h
ChangeLog, Makefile.in, test_icount.c, test_rel.c:
  test_icount.c, test_rel.c: Change location of ext2_fs.h to be
  	ext2fs/ext2_fs.h
2001-05-14 11:45:38 +00:00
Theodore Ts'o 86c627ec11 Many files:
dirinfo.c, e2fsck.h, emptydir.c, iscan.c, jfs_user.h, journal.c,
  	message.c, pass1.c, pass1b.c, pass2.c, pass3.c, pass4.c, pass5.c,
  	problem.h, scantest.c, super.c, swapfs.c: Change ino_t to ext2_ino_t.
2001-01-11 15:12:14 +00:00
Theodore Ts'o 0c4a07264e Many files:
badblocks.c, e2fsck.h, ehandler.c, emptydir.c, extend.c, flushb.c,
  	iscan.c, message.c, pass1.c, pass1b.c, pass3.c pass4.c, pass5.c,
  	problem.c, scantest.c, swapfs.c, unix.c, util.c: Add
  	Internationalization support as suggested by Marco d'Itri
  	<md@linux.it>.
2000-02-07 03:11:03 +00:00
Theodore Ts'o 80e808fceb ChangeLog, debugfs.c:
debugfs.c (dump_inode): Remove #ifdef for i_version vs. i_generation
  	since we know it will always be i_generation now.
ChangeLog, e2fsck.h, flushb.c, scantest.c:
  e2fsck.h, flushb.c, scantest.c: Remove uneeded include of linux/fs.h
bmap.c:
  Fix silly spelling typo.
ChangeLog, getsize.c, ismounted.c, swapfs.c:
  getsize.c, ismounted.c: Remove unneeded include of linux/fs.h
  swapfs.c: Remove #ifdef HAVE_EXT2_INODE_VERSION since it's not needed
  	any more; we know it will always be i_generation.  Add support for
  	swapping the high bits of the uid and gid.
2000-02-02 16:19:59 +00:00
Theodore Ts'o 1b6bf1759a Many files:
pass*.c, super.c: Massive changes to avoid using printf and com_err
  	routines.  All diagnostic messages are now routed through the
  	fix_problem interface.
  pass2.c (check_dir_block): Check for duplicate '.' and '..' entries.
  problem.c, problem.h: Add new problem codes PR_2_DUP_DOT and
  	PR_2_DUP_DOT_DOT.
  problem.c: Added new problem codes for some of the superblock
  	corruption checks, and for the pass header messages.  ("Pass
  	1: xxxxx")
  util.c (print_resource_track): Now takes a description argument.
  super.c, unix.c, e2fsck.c: New files to separate out the
  	operating-specific operations out from e2fsck.c.  e2fsck.c now
  	contains the global e2fsck context management routines, and
  	super.c contains the "pass 0" initial validation of the
  	superblock and global block group descriptors.
  pass1.c, pass2.c, pass3.c, pass4.c, pass5.c, util.c: Eliminate
  	(nearly) all global variables and moved them to the e2fsck
  	context structure.
  problem.c, problem.h: Added new problem codes PR_0_SB_CORRUPT,
  	PR_0_FS_SIZE_WRONG, PR_0_NO_FRAGMENTS, PR_0_BLOCKS_PER_GROUP,
  	PR_0_FIRST_DATA_BLOCK
expect.1, expect.2:
  Updated tests to align with e2fsck problem.c changes.
1997-10-03 17:48:10 +00:00
Theodore Ts'o 50e1e10fa0 Many files:
Checked in e2fsprogs 0.5c
1997-04-26 13:58:21 +00:00
Theodore Ts'o f3db3566b5 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:34:30 +00:00