summaryrefslogtreecommitdiff
path: root/sbin/fsck_ext2fs
AgeCommit message (Collapse)Author
2021-01-27shuffle externs (and definitions) around to satisfy -fno-commonTheo de Raadt
ok mortimer
2019-12-17Use correct size when zeroing out dinode.Todd C. Miller
Fixes a bug on file systems using the rev1 inode structure where the size of the in-memory and on-disk dinode differ. From Chris Waddey; OK deraadt@
2019-07-01Oops, forgot to commit this patch.Kevin Lo
2019-06-28When system calls indicate an error they return -1, not some arbitraryTheo de Raadt
value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future.
2019-02-06Replace overlapping memcpy() with memmove() in getpathname().Todd C. Miller
Same fix as in fsck_ffs. OK deraadt@ tb@
2018-09-24Use unveil(2). These programs fit together in various strange ways,Theo de Raadt
so if a problem is encountered with this the whole set needs backout and study.
2018-09-16Use user_from_uid(3) and group_from_gid(3) in a few more placesTodd C. Miller
that do repeated lookups. OK tb@
2017-08-26Do not check the array but its length; based on a netbsd commit by christos@;Otto Moerbeek
also unsigned values cannot be < 0; ok millert@
2016-12-16Eliminate some gcc warnings about 'unused variables', mostly byKenneth R Westerback
adding appropriate #ifdef's around declarations. ok millert@ (with a tweak I will commit separately)
2016-04-28Fix fsck'ing. ext2fs_dinode grew extra bits to support ext4Kenneth R Westerback
and sizeof(struct ext2fs_dinode) had to be replaced with EXT2_DINODE_SIZE() and such. ok beck@
2016-03-16More "(<blah> *)0" -> NULL, avoiding any stdarg functions.Kenneth R Westerback
Feedback millert@ kettenis@
2015-11-25Do not do the early pledge, because hotroot() is a lie. fsck_extfsTheo de Raadt
is not correct duid-aware by itself.
2015-11-23Cannot pledge() in the hotroot caseTheo de Raadt
Discovered by krw
2015-11-23Use pledge "disklabel" as needed. The theory here is these tools become moreTheo de Raadt
resistant against memory correctup, if a corrupt filesystem is given to them. ok krw
2015-10-15corrects pledge code for fsck_ffs and fsck_ext2fsSebastien Marie
on filesystem error, fsck will try to display username of inode, resulting need of "getpw" for not SMALL version. add a missed (?) -DSMALL in distrib/special/ for fsck_ffs and fsck_ext2fs found by hard way by ajacoutot@ OK millert@
2015-10-14Since the fsck_* programs now only handle one filesystem, this createsTheo de Raadt
a point where open() and disklabel reading have completed. After that point, pledge "stdio". As a result, an fsck of a hostile partition (noone ever does that, or do they? :) is done by a program with SUBSTANTIALLY less system call exposure. ok semarie
2015-10-14Only accept one filesystem/device as argument for checking. Few peopleTheo de Raadt
will be calling these directly, and not for the multiple filesystem case. fsck(8) is generally the parent and will handle things. ok semarie; this change will also help a goal jsing has
2015-09-10avoid divide by zero; from Michael McConvilleTheo de Raadt
2015-09-05snprintf+write --> dprintfPhilip Guenther
ok deraadt@
2015-08-20<stdlib.h> is included, so do not need to cast result fromTheo de Raadt
malloc, calloc, realloc* ok krw millert
2015-07-27document "F" in interactive mode, like for fsck.8;Jason McIntyre
from michael mcconville ok deraadt
2015-02-07When getopt processing flags, many should be flag=1 instead of flag++Theo de Raadt
ok tedu miod
2015-01-19remove #ifndef #define blocks trying to handle lack of BUFSIZTheo de Raadt
ok millert
2015-01-16Replace <sys/param.h> with <limits.h> and other less dirty headers whereTheo de Raadt
possible. Annotate <sys/param.h> lines with their current reasons. Switch to PATH_MAX, NGROUPS_MAX, HOST_NAME_MAX+1, LOGIN_NAME_MAX, etc. Change MIN() and MAX() to local definitions of MINIMUM() and MAXIMUM() where sensible to avoid pulling in the pollution. These are the files confirmed through binary verification. ok guenther, millert, doug (helped with the verification protocol)
2014-11-20remove sys/file.h includes in favor of fcntl.h where needed.Ted Unangst
ok deraadt guenther
2014-10-29remove ugly return value castsTheo de Raadt
2014-10-08trivial use of reallocarrayTheo de Raadt
2014-07-13kill fs2hXX/h2fsXX macros with letohXX/htoleXXMartin Pelikan
The reason being that ext2 structures are little-endian but JBD2 journal is big-endian. Don't confuse readers by talking about "file system endian". ok guenther
2014-07-13new superblock header needs fixesMartin Pelikan
2014-07-11Prevent division by zero on erroneous file systems.Tobias Stoeckmann
ok pelikan@
2014-07-11fix dacl->size_hi header changeMartin Pelikan
2014-05-24Use consistent format specifiers (%lld) and casts (long long) whenKenneth R Westerback
printing out block numbers and sector numbers. Make output verbiage consistent. -Wall happier. Original diff and ok chl@
2014-05-24Don't potentially use stack garbage for e2d_type. InitializeKenneth R Westerback
newent.e2d_type to EXT2_FT_UNKNOWN, a.k.a. 0. Spotted by -Wall.
2014-05-22Nuke pointless dev_bsize variable which is always set to 512, and justKenneth R Westerback
use DEV_BSIZE. Write sizes need to be secsize and not DEV_BSIZE, just like reads. Equivalent to changes made in fsck_ffs.
2014-05-21Nuke some trailing whitespace to shrink subsequent diffs.Kenneth R Westerback
2014-05-20As suggested by guenther@ and millert@, replace seek+[read|write] withKenneth R Westerback
p[read|write]. Makes the code much clearer by eliminating extra error checking and verbiage. No intentional functional change. Tweaks by and ok guenther@
2013-11-22Kirk was being waaaay too chummy with the compiler when he trustedPhilip Guenther
it to not optimize away a comparison against NULL-1. Add (unsigned char) casts for some ctype calls. Teach fsck_ext2fs about MAXPARTITIONS, letting it operate on partitions 'i' through 'p'. ok deraadt@ millert@ otto@
2013-04-25big int_t/time_t fixes; ok deraadt@ krw@Otto Moerbeek
2013-04-24pretty print bigger off_tTheo de Raadt
ok tedu otto
2013-04-17ext2fs has a 32-bit time fields. store a u_int32_t of the real time_t --Theo de Raadt
that should tide us over for a long time. ok guenther
2011-04-18Remove a header file that is only supposed to be used by the kernel.Theo de Raadt
2011-03-12These utilities can currently only operate with a 32-bit block number range,Theo de Raadt
so use daddr32_t ok jasper
2010-08-12Print the real device name followed by the disklabel UID in parenthesisJoel Sing
when fsck is run against a disklabel UID. This allows a user to determine which device is really being scanned. ok krw@
2010-05-18dont let sys/ioctl.h imply that you get the ioctls in dkio.h. thisDavid Gwynne
gets rid of #include <sys/dkio.h> in sys/ioctl.h and adds #include <sys/dkio.h> to the places that actually want and use the disk ioctls. this became an issue when krw@'s X build failed when he was testing a change to dkio.h. tested by krw@ help from and ok miod@
2010-03-08if ncg == 1, there's no alternate superblock; from NetBSD; ok deraadt@Otto Moerbeek
2010-01-10remove references to docs we no longer install;Jason McIntyre
2009-12-10do not leak memory, found by parfait, ok millert ottoTheo de Raadt
(one case was a false positive, but one is a modified copy of the other)
2009-10-28rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andTheo de Raadt
unmaintainable). these days, people use source. these id's do not provide any benefit, and do hurt the small install media (the 33,000 line diff is essentially mechanical) ok with the idea millert, ok dms
2007-09-02use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgTheo de Raadt
2007-05-31convert to new .Dd format;Jason McIntyre