Commit Graph

90 Commits (7e0136332c072ae4b13788867e7f840baaffe0ab)

Author SHA1 Message Date
Theodore Ts'o 9a23fa8334 Merge branch 'maint' into next 2016-08-10 18:53:14 -04:00
Andreas Dilger 713edbd082 fsck: fix strange logic
llvm warns about the confusingly written comparison:

                              !strncmp(argv[i+1], "-", 1) == 0) {
    misc/fsck.c:1178 col 9: warning: logical not is only applied to
      the left hand side of comparison [-Wlogical-not-parentheses]
    misc/fsck.c:1178 col 9: note: add parentheses after the '!' to
      evaluate the comparison first
    misc/fsck.c:1178 col 9: note: add parentheses around left hand
      side expression to silence this warning

It makes sense to simplify this to a character comparison rather
than using strncmp() to check only one character.

Signed-off-by: Andreas Dilger <andreas.dilger@intel.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2016-08-10 18:21:19 -04:00
Theodore Ts'o 99ceb8ec1a Move the check_plausibility() function from misc to lib/support
The check_plausibility() function is now used all over the place, so
we should move the plausible.c file to lib/support and remove the
special case handling for that file that had been in the build system.

Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2015-07-12 22:01:17 -04:00
Theodore Ts'o f404167dda Clean up sparse warnings
Mostly by adding static and removing excess extern qualifiers.  Also
convert a few remaining non-ANSI function declarations to ANSI.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2013-12-16 18:56:36 -05:00
Theodore Ts'o d47e2af763 fsck: don't include sys/signal.h for portability reasons
It isn't necessary to include sys/signal.h, and it's not available on
all systems.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2012-04-05 15:21:49 -07:00
Theodore Ts'o 3fcd8fe8ac Fix more spelling errors found by translators and add pluralization
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2011-10-09 17:54:23 -04: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
Eric Sandeen 80f4b3ae49 fsck: fix -C option parsing
The i++; statement is unreachable; fix same as commit
f1c2eaac535bd9172a35ce39b6d8f392321f274d in util-linux

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Theodore Ts'o <tytso@mit.edu>
2011-09-16 18:43:04 -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 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 ebabf2ad6d Define _XOPEN_SOURCE to 600 consistently for Solaris C99 support
Solaris's header files are very picky about which C compiler can be
used for SUSv3 conformance.  Use of C99 is not compatible with SUSv2
(_XOPEN_SOURCE=500), and C89 is not compatible with SUSv3
(_XOPEN_SOURCE=600).  Since we need some SUSv3 functions, consistently
use SUSv3 so that e2fsprogs will build on Solaris using c99.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-07-13 16:06:57 -04:00
Theodore Ts'o a70f10dbc4 Merge branch 'maint' 2008-03-30 14:03:51 -04:00
Theodore Ts'o bf209ab795 fsck: Treat "ext4" and "ext4dev" as ext* filesystems
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-26 08:58:25 -04:00
Theodore Ts'o a16834335d fsck: Make -Cn work correctly where n != 0
Previously, fsck was only passing in -Cn to the first e2fsck process
to start up, and enabling the progress information by sending a
SIGUSR1 signal.  This didn't work if the progress information was
intended to go to file descriptor, since the information was never
passed to e2fsck.

So we now pass the progress fd in as a negative number if the progress
information is intended to be initially suppressed.

Addresses-Launchpad-Bug: #203323
Addresses-Sourceforge-Bug: #1926023

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-26 08:53:13 -04:00
Theodore Ts'o ab7862049a fsck: Fix -C handling so that subsequent progress bars are enabled
The exiting fsck instance wasn't marked as DONE, so the safety checks
thought a progress bar was still in progress, and so we didn't enable
another filesystem's checking.

Addresses-Debian-Bug: #432865
Addresses-Launchpad-Bug: #203323
Addresses-Sourceforge-Bug: #1926023

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-26 08:11:11 -04:00
Theodore Ts'o 2d328bb76d Fix miscellaneous gcc -Wall warnings
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-03-17 23:17:13 -04:00
Theodore Ts'o 1547265859 fsck: Don't complain about an old-style fstab if the fstab is empty
Addresses-Debian-Bug: 468176

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-27 14:19:18 -05:00
Theodore Ts'o fe263da923 Make fsck ignore mounted filesystems if given the -M option
Adapted from the SuSE patch, but fixes a number of very serious
problems with the patch in SLES:

1) This changeset uses -M instead of -m; most lowercase options are
reserved for use by the filesystem-specific fsck programs.  All new
fsck options must be upper case.

2)  This changeset will skip the root filesystem in "fsck -AM", which
the SLES patch will not do.

3)  Loading /proc/mounts into the fs_info can cause -t opts matching to
malfuction.  So this changeset uses a simplified version of the
ismounted.c function from the ext2fs library.

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2008-02-17 17:35:46 -05:00
Theodore Ts'o 5221837e62 fsck: '#' is only a comment character at the beginning of an fstab line
Fuse and ssh fstab lines such as:

  wdfs#https://dav.hoster.com/foo/bar /mnt/hoster fuse user,noauto 0 0

will cause fsck to issue warnings about invalid fstab lines, because
fsck was previously treating '#' as a comment when it appeared
anywhere in an fstab line, not just at the beginning of the line.

Addresses-Gentoo-bug: #195405
Addresses-Sourceforge-bug: #1826147

Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-12-16 15:41:15 -05:00
Theodore Ts'o ed773a2638 fsck: Ignore /etc/fstab entries for bind mounts
If a user specifies a bind mount with a non-zero fsck pass number, for
example:

/foo    /bar    ext3    bind,defaults   1 3

print a warning and ignore the fstab entry.

Addresses-Red-Hat-Bugzilla: #151533

Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>
2007-09-20 15:06:35 -04:00
Brian Behlendorf 12f8ff440c [COVERITY] Fix memory leak in fsck on error paths
The memory allocated by inst is not reclaimed.  There also was a
call to exit that coverity did not catch the resource leak.  This
might not really be a big issue since the memory will be freed when
fsck exits, but it should be done anyway imho.

Coverity ID: 32: Resource Leak

Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2007-03-28 09:48:07 -04:00
Matthias Andree 322d9d4852 fsck.c:
Include <signal.h> to avoid compiler trouble.
2005-01-13 03:44:50 +01:00
Theodore Ts'o 22dcccdd1a fsck.c (PRS): Apply Fedora's e2fsprogs-1.35-progress.patch from
e2fsprogs-1.35-11.2.  Fixed multiple command-line parsing
	bugs so that backwards compatibility is maintained, and so
	that certain command-line options wouldn't be ignored.
2005-01-05 13:43:29 -05:00
Theodore Ts'o c88bce8df0 In fsck, check return from malloc of fsck_path, and print an error message
if it fails.
2004-12-22 00:49:06 -05:00
Theodore Ts'o 993aa11dc8 fsck.c (execute): Use '&&' instead of '&'. (It didn't cause a
problem because we got lucky, but let's do things right.
	Fix from Thomas Woerner at Red Hat.)
2004-02-21 21:02:15 -05:00
Theodore Ts'o 544349270e Fix gcc -Wall nitpicks 2003-12-07 01:28:50 -05:00
Theodore Ts'o 5e38fed9c5 fsck.c (wait_many): Rename wait_all() to wait_many(), and have
new semantics: WAIT_ALL vs. WAIT_ATLEAST_ONE.  This fixes
	a bug where when fsck is waiting for another partition on
	the same spindle, it spins wasting a lot of CPU.
2003-07-21 20:43:21 -04:00
Theodore Ts'o 2ecaaf6557 Put stdout and stderr into non-buffered mode to
avoid cosmetic problems when running fsck under logsave.
2003-04-16 16:13:58 -04:00
Theodore Ts'o ee828a9d1e fsck.c (parse_fstab_line, interpret_type, fsck_device, ignore,
main): Don't evaluate the filesystem type when loading the
	fstab file, since that might cause fsck to hang trying to
	read from a floppy disk.  (Addresses Debian bug #187812)
	Add tmpfs and devpts to filesystems that should be
	ignored, and add jfs, reseirfs, and xfs as filesystems
	types where we should complain if we can't find the fsck
	program for that filesystem type.
2003-04-06 23:08:47 -04:00
Theodore Ts'o e71d87317a Add Apple/Darwin patches. 2003-03-14 02:13:48 -05:00
Theodore Ts'o ed1b33e8fb Minor bug fixes in the blkid library.
Convert mke2fs, fsck, and tune2fs to use the blkid library.
2003-03-01 19:29:01 -05:00
Theodore Ts'o 76ea3a2c7f fsck.c (parse_fstab_line, parse_escape): Add support for
backslash escaping in /etc/fstab.  (i.e., so that \040
	will work.)
2003-01-22 19:55:59 -05:00
Theodore Ts'o 1d4c7945ff fsck.c (main): Fix bug reported by Gregory Mutt. Multiple
filesystems explicitly specified on the command line were
	not being checked in parallel, due to a logic bug
	introduced in to support the FSCK_MAX_INST environment
	variable.
2002-10-28 16:52:12 -05:00
Theodore Ts'o 3e69906495 Fix gcc -Wall nits.
Fix format bug if NLS is in use.

Add extra so that the info directory looks OK on OpenWall.
2002-10-13 23:56:28 -04:00
Theodore Ts'o 84bd550148 fsck.c: If the bone-headed user enters the filename twice, the
-R option which skips the root filesystem will skip all of
	them.  (Addresses Debian bug #159423).  Note!  This is not
	a precedent for dealing intelligently with any other kind
	of doubled entry in /etc/fstab!
2002-09-24 00:13:19 -04:00
Theodore Ts'o a141135451 fsck.c (main): If no filesystems are specified on the command
line, default to -As.  (Addresses Debian Bug #153102)

badblocks.8.in: Clarify why it's bad to do a non-destructive
	test on a r/o mounted filesystem.  (Addresses Debian Bug
	#131350)
2002-08-17 17:39:39 -04:00
Theodore Ts'o 4cae04529e Add SIGINT and SIGTERM handling to fsck and e2fsck. For e2fsck,
make sure we gracefully clean up and only exit at safe points.
For fsck, we pass the SIGINT/SIGTERM signal to the child processes,
so they can do their own cleanup.
2002-07-21 14:14:03 -04:00
Theodore Ts'o 14308a5398 Newer libintl needs LC_CTYPE to be set in addition to LC_MESSAGES. 2002-03-05 03:26:52 -05:00
Theodore Ts'o 5599c2fa87 Changed fsck to support filesystems types in /etc/fstab of the form
"ext3,ext2", etc.

Added support for only searching for a specified list of filesystems.
	Also add support for identifying reiserfs filesystems.
2002-02-03 00:08:52 -05:00
Theodore Ts'o a1069118d4 fsck.c: Allow the number of outstanding processes fs-specific
fsck programs to be capped via the FSCK_MAX_INST
	envrionment variable.

fsck.8.in: Document all of the environment variables used by fsck.
2002-01-29 12:49:14 -05:00
Theodore Ts'o 4ea7bd0439 Fix various gcc -Wall nits. Fixed a bug in mke2fs where a bogus
error message could be printed on an malloc() failure, and e2image
was optimized to avoid needless system calls by using the stashed
inode functions.
2001-12-16 23:23:37 -05:00
Theodore Ts'o 6430bd67ce fsck.c (interpret_type): If the "auto" type is specified, make
sure interpet_device() is called so that device
	specifications which use LABEL= or UUID= are translated
	into a real device name.
2001-11-05 18:58:46 -05:00
Theodore Ts'o 0f8973fb09 Remove EXT2FS_VERSION from the version display, since it
only confuses people.

Make fsck's version display be consistent with the other e2fsprogs
programs.
2001-08-27 12:44:23 -04:00
Andreas Dilger 2d15576dfe get_device_by_label.[ch], fsck.c, util.c: New interpret_spec()
function in get_device_by_label.c to allow the use of
        UUID= or LABEL= when creating filesystems which use external
        journal dev (e.g.  mke2fs -J device=LABEL=<journal_label>).

tune2fs.c: Use superblock s_journal_uuid to locate an external
        journal device instead of s_journal_dev when removing it.
        Allow opening journal devices to set the label and UUID
        in the ext2 superblock.

mke2fs.c, tune2fs.c: Free journal_device after use, as it is
        malloc'd in interpret spec.
2001-08-17 03:48:11 -06:00
Theodore Ts'o 685c13f6d7 fsck.c (main): Print a warning message if there are no devices to
be checked.  (Addresses Debian bug #107458.)
2001-08-15 19:04:59 -04:00
Theodore Ts'o 88f8af61a4 fsck.c (check_all): Don't bother to interpret a device where the
pass number is zero.  (Addresses Debian bug #106696).
2001-08-15 18:39:51 -04:00
Theodore Ts'o da376f5a13 fstype.c (identify_fs): New file which looks at the superblock
of the filesystem to determines its type.

fsck.c (fsck_device, ignore, interpret_type): Call identify_fs
	if the type specified in /etc/fstab is "auto".
2001-07-19 20:38:53 -04:00
Theodore Ts'o 28cf9041b8 ChangeLog, fsck.c:
fsck.c (device_already_active): Fixed bug which can cause fsck to core
  	dump if there are a mix of devices with standard and non-standard
  	names.
2001-06-12 22:35:00 +00:00
Theodore Ts'o c7a24e461e ChangeLog, fsck.c:
fsck.c (compile_fs_type): Fix I18N compilation bug: use N_() instead
  	of _() to initialize static variables.
2001-05-23 22:26:39 +00:00
Theodore Ts'o 10a32f1e03 ChangeLog, fsck.8.in, fsck.c:
fsck.8.in, fsck.c (compile_fs_type, fs_type, ignore): Fix handling of
  	-t option to be more intuitive.  Also add support for the Mandrake -t
  	loop hack.  See man page for description of new -t semantics.
2001-05-21 02:15:15 +00:00