Commit Graph

21 Commits (d1154eb460efe588eaed3d439c1caaca149fa362)

Author SHA1 Message Date
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
Eric Sandeen fe65f1ecfc e2fsprogs: Don't try to close an fd which is negative
These reflect either file descriptors which aren't tested
for failure, or closures of fd's which may have failed.

In setup_tdb(), test for failure of mkstemp and return
without trying to open the file (again).

In reserve_stdio_fds, rather than closing the "extra"
fd == 3 due to the way the loop is written, just
don't go that far by using while (fd <= 2).

In logsave, it forks and retries forever if open fails,
but at least make coverity happy by explicitly not
trying to close a negative file descriptor.

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16 19:55:55 -04:00
Eric Sandeen 14ed2edb26 e2fsck: remove extraneous memset
e2fsck_allocate_memory() already sets allocated memory to 0,
so remove the explicit memset.

Especially since it was setting the wrong size (iter not *iter)

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16 18:43:05 -04:00
Theodore Ts'o 23f75f6efa e2fsck: fix miscellaneous memory leaks
Fix various miscellaneous memory leaks which were discovered using valgrind.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2009-06-15 03:54:06 -04:00
Jim Meyering 45e338f533 remove useless if-before-free tests
In case you're wondering about whether this change is safe from a
portability standpoint, fear not.  This has been beaten to death
in other forums.  Here are a few threads:

  http://thread.gmane.org/gmane.comp.version-control.git/74187
  http://thread.gmane.org/gmane.comp.lib.gnulib.bugs/12712
  http://thread.gmane.org/gmane.emacs.devel/98144
  http://thread.gmane.org/gmane.comp.lib.glibc.alpha/13092

There has been debate about whether it's a good idea from a
performance standpoint, too, but imho you'll have a hard time
finding an instance where this sort of change induces a
measurable performance penalty.  If you do, please let me know.

Signed-off-by: Jim Meyering <meyering@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2009-03-08 20:37:12 -04:00
Theodore Ts'o 5e9ba85c26 Fix e2fsck segfault on very badly damaged filesystems
A recent change to e2fsck_add_dir_info() to use tdb files to check
filesystems with a very large number of filesystems had a typo which
caused us to resize the wrong data structure.  This would cause a
array overrun leading to malloc pointer corruptions.  Since we
normally can very accurately predict how big the the dirinfo array
needs to be, this bug only got triggered on very badly corrupted
filesystems.

Thanks to Andreas Dilger for submitting the test case which discovered
this problem, and to Kalpak Shah for writing a random testing script
which created the test case.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-07-11 13:42:43 -04:00
Theodore Ts'o f954ba012f Fix gcc -Wall issues in e2fsck sources
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
Signed-off-by: Andreas Dilger <adilger@clusterfs.com>
2007-05-22 20:53:01 -04:00
Theodore Ts'o a1f642728f Fix memory leaks from using the tdb library
We weren't freeing allocated memory from calls to tdb_fetch, tdb_firstkey,
and tdb_nextkey.  Oops.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-06 23:28:30 -04:00
Theodore Ts'o 25a9fe2894 Enable e2fsck to use the tdb library to store the dirinfo abstraction
If e2fsck.conf configures a scratch_files directory which is available,
and the number of directories exceeds scratch_files.numdirs_threshold,
then try to use the tdb library to store the directory information
abstraction.  This allows us to check very large filesystems without
needing as much physical memory.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-06 18:44:37 -04:00
Theodore Ts'o 28db82a84a Rework e2fsck's dirinfo abstraction to be more friendly for databases
Change the iterator abstraction and replace e2fsck_get_dir_info() with
e2fsck_dir_info_{set,get}_{parent,dotdot} so that we can support an
on-disk dirinfo implementation.  This allows e2fsck to check very large
filesystems on systems with smaller amounts of memory and/or address
space.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-04-04 22:33:31 -04:00
Theodore Ts'o c4e3d3f374 ext2fs_getmem(), ext2fs_free_mem(), and ext2fs_resize_mem()
all now take a 'void *' instead of a 'void **' in order to 
avoid pointer aliasing problems with GCC 3.x.
2003-08-01 09:41:07 -04: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 76f875daa1 Many files:
ext2fs.h, bitops.h: Add support for the Watcom C compiler to do inline
  	functions.
  ext2fs.h, dosio.c: Use asm/types.h instead of linux/types.h to evade a
  	potential problem with glibc's header files trying to spike out
  	linux/types.h.
  ext2fs.h (ext2fs_resize_mem): Change the function prototype to include
  	the old size of the memory, which is needed for some braindamaged
  	memory allocation systems that don't support realloc().
  badblocks.c (ext2fs_badblocks_list_add):
  bb_inode.c (clear_bad_block_proc):
  dblist.c (ext2fs_add_dir_block):
  icount.c (insert_icount_el):
  irel_ma.c (ima_put):
  rs_bitmap.c (ext2fs_resize_generic_bitmap): Update functions to pass
  	the old size of the memory to be resized to ext2fs_resize_mem().
ChangeLog, dirinfo.c:
  dirinfo.c (e2fsck_add_dir_info): Update function to pass the old size
  	of the memory to be resized to ext2fs_resize_mem().
ChangeLog, extent.c, resize2fs.c:
  resize2fs.c (adjust_superblock):
  extent.c (ext2fs_add_extent_entry): Update functions to pass the old
  	size of the memory to be resized to ext2fs_resize_mem().
1998-04-27 01:41:13 +00:00
Theodore Ts'o 54be2ccc22 ChangeLog, dirinfo.c, e2fsck.c, e2fsck.h, super.c:
dirinfo.c, e2fsck.c: Don't include com_err.h; it isn't needed.
  e2fsck.h: Include <time.h> since it is needed
  super.c: If EXT2_SKIP_UUID is defined, then skip the UUID processing.
1998-02-01 12:58:48 +00:00
Theodore Ts'o 54dc7ca286 Many files:
e2fsck.h: If EXT2_FLAT_INCLUDES is defined, then assume all of
  	the ext2-specific header files are in a flat directory.
  dirinfo.c, ehandler.c, pass1.c, pass1b.c, pass2.c, pass5.c,
  	super.c, swapfs.c, unix.c: Explicitly cast all assignments
  	from void * to be compatible with C++.
  unix.c (sync_disk): Remove sync_disk and calls to that function,
  	since ext2fs_close() now takes care of this.
  pass1.c, pass1b.c, pass2.c, pass3.c, swapfs, badblocks.c,
  	ehandler.c, unix.c: Change use of private to be priv_data, to
  	avoid C++ reserved name clash.
1998-01-19 14:50:49 +00:00
Theodore Ts'o 5be8dc2143 Many files:
dblist.c (ext2fs_get_num_dirs): Make ext2fs_get_num_dirs more paranoid
  	about validating the directory counts from the block group
  	information.
  all files: Don't include stdlib.h anymore; include it in ext2_fs.h,
  	since that file requires stdlib.h
ChangeLog, Makefile.in, dirinfo.c:
  dirinfo.c (e2fsck_add_dir_info): Use ext2fs_get_num_dirs instead of
  	e2fsck_get_num_dirs, which has been removed.
  Makefile.in (PROGS): Remove @EXTRA_PROGS@, since we don't want to
  	compile and install flushb.
ChangeLog, configure.in:
  Remove @EXTRA_PROGS@, since we aren't using it in 2fsck/Makefile.in anymore
ChangeLog, Makefile.in:
  Install debugfs in /sbin, instead of /usr/sbin.
libext2fs.texinfo:
  Update version string to be 1.12
Makefile.in:
  Fix bug in find script which made the exclusion list, where a '-' was
  missing from an -name option.
1997-12-01 18:24:10 +00:00
Theodore Ts'o f8188fff23 Many files:
pass1.c, pass2.c, pass3.c, pass4.c, pass5.c: Add calls to the progress
  	indicator function.
  pass1.c (scan_callback): Add call to the progress feedback function
  	(if it exists).
  super.c (check_super_block): Skip the device size check if the
  	get_device_size returns EXT2_EXT_UNIMPLEMENTED.
  iscan.c (main): Don't use fatal_error() anymore.
  pass1b.c, swapfs.c, badblocks.c: Set E2F_FLAG_ABORT instead of calling
  	fatal_error(0).
  problem.c, pass3.c (PR_3_ROOT_NOT_DIR_ABORT,
  	PR_3_NO_ROOT_INODE_ABORT): New problem codes.
  problem.c, pass2.c (PR_2_SPLIT_DOT): New problem code.
  problem.c, pass1.c (PR_1_SUPPRESS_MESSAGES): New problem code.
  problemP.h: New file which separates out the private fix_problem data
  	structures.
  util.c, dirinfo.c, pass1.c, pass1b.c, pass2.c, pass5.c, super.c,
  	swapfs.c util.c: allocate_memory() now takes a e2fsck context as its
  	first argument, and rename it to be e2fsck_allocate_memory().
problemP.h:
  New file which contains the private problem abstraction definitions.
Makefile.pq:
  Remove include of MAKEFILE.STD, which doesn't exist at this point.
1997-11-14 05:23:04 +00:00
Theodore Ts'o 08b213017f Many files:
Change ext2fs_read_inode, ext2fs_write_inode to take the e2fsck
  context as their first argument.
  Change dir_info.c routines to take an e2fsck_context, renamed them to
  start with e2fsck_ to avoid namespace issues, and changed them to
  store the directory information inside the e2fsck context.
  Added e2fsck_run() which calls all of the e2fsck passes in the correct
  order, and which handles the return of abort codes.
  Added abort processing, both via setjmp/longjmp and via flags in the
  e2fsck context.
  Use a flag in the e2fsck context instead of the restart_e2fsck global
  variable.
  Change uses of free and malloc to ext2fs_free_mem and ext2fs_get_mem.
1997-11-03 19:42:40 +00:00
Theodore Ts'o 21c84b71e2 Many files:
Checked in e2fsprogs-1.07
1997-04-29 16:15:03 +00:00
Theodore Ts'o f3db3566b5 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:34:30 +00:00
Theodore Ts'o 3839e65723 Many files:
Checkin of e2fsprogs 0.5b
1997-04-26 13:21:57 +00:00