summaryrefslogtreecommitdiff
path: root/sbin/fsck_ffs
AgeCommit message (Collapse)Author
2022-03-31man pages: add missing commas between subordinate and main clausesChristian Weisgerber
jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
2021-07-12Change the error reporting pattern throughout the tree when unveilBob Beck
fails to report the path that the failure occured on. Suggested by deraadt@ after some tech discussion. Work done and verified by Ashton Fagg <ashton@fagg.id.au> ok deraadt@ semarie@ claudio@
2021-03-08Add some references, most of these were removed when we stopped buildingJonathan Gray
and installing USD/SMM/PSD docs. jmc@ agrees with the direction, ok millert@ on an earlier diff
2021-01-27shuffle externs (and definitions) around to satisfy -fno-commonTheo de Raadt
ok mortimer
2020-07-13Both phase 1 and phase 5 need the cylinder group meta data, so save thoseOtto Moerbeek
in phase one to be used in phase 5, unless we're tight on memory. From FreeBSD; ok bket@
2020-06-20With filesystem having many cylinder groups and many inodes per cg theOtto Moerbeek
ncg * ipg calcualtion can overflow if signed types are used. Move to uint32_t for the relevant values. Aligned with FreeBSD changes. Also make sure newfs refuses to create an fs with more that 2^32-1 inodes. ok millert@
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
Found the hard way and OK 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@
2018-01-05the value of bflag is a blockno, so use the proper type, avoidsOtto Moerbeek
an overflow seen with scanning for alternate superblocks; ok deraadt@
2017-04-13fix wrongly indented linesJonathan Gray
2017-04-12Prevent inosused from wrapping when soft updates is enabled whileTodd C. Miller
scanning the used inode map. The code as written assumes inosused is signed but this is no longer the case. OK deraadt@
2017-04-10Remove always false comparison: inosused type is ino_t, which isFrederic Cambus
unsigned. While there, fix a whitespace issue. OK deraadt@
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-09-09Tighten pledge for fsdb and eliminate a strcmp("fsdb", getprogname())Theo Buehler
by passing a flag to setup(). ok deraadt
2016-09-01better words for -b, wiyh help from jmc@Otto Moerbeek
2016-09-01better computation of location of alternate superblocks, based on infoOtto Moerbeek
in the label; ok deraadt@ krw@
2016-08-20fsdb(8) sucks in and is pledged by fsck(8). Since it uses editline(3),Theo Buehler
add a special case for the missing "rpath" and "tty" promises. Issue found and initial analysis by Jan Stary, thanks! ok deraadt
2015-12-10Remove NULL-checks before free(). ok tb@mmcc
2015-11-24hotroot is calculated late in fsck_ffs, so defer the pledge.Theo de Raadt
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-15fsck_ffs has a ^T signal handler which opens /dev/tty late. Hoist thatTheo de Raadt
opening to before the pledge, and cache the fd. looked over by 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-05snprintf+write --> dprintfPhilip Guenther
ok deraadt@
2015-08-22spacingTheo de Raadt
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-20Adjust <sys/param.h> comments regarding use of use of MAXFRAG, orTheo de Raadt
delete <sys/param.h> if now possible ok guenther
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-10-14rely on reallocarray() to give us the overflow detection, rather thanTheo de Raadt
hand-crafting a solution. ok millert
2014-10-08trivial use of getreallocarray()Theo de Raadt
2014-09-06inodesc.id_entryno holds a file size, so upgrade it from int to u_int64_t;Philip Guenther
this fixes handling of very large files on FFS2. Correct a copy-n-pasto that rendered useless the check for allocated fragmented that are marked free in the bitmap. allocdir() returns an inode number, so return an ino_t. sizeof()*N should be printed with %zu, while direct and indirect block numbers should be cast to (long long) use %lld inodesc.id_entryno fix based on a diff from David Vasek <vasek@fido.cz> ok krw@ otto@
2014-07-08decouple struct uvmexp into a new file, so that uvm_extern.h and sysctl.hTheo de Raadt
don't need to be married. ok guenther miod beck jsing kettenis
2014-05-29fsck should use the same values in checking as newfs does in creatingKenneth R Westerback
a filesystem. fs_nspf and its derivitives like fs_spc are DEV_BSIZE values, not actual hardware disk sector values. Adjust initializations accordingly. Tweak header and man page comments to make the DEV_BSIZE'ness more obvious for future spelunkers. No-op for DEV_BSIZE (a.k.a. 512-byte) sector devices but should help checking filesystems on, e.g., 4k-byte sector devices. ok jmc@ on the man page tweaks.
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-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@
2014-05-09Modernize spelling. 'Mimick' -> 'Mimic' in comment.Kenneth R Westerback
2014-05-09Fix '-b' option to work with the superblock locations output by newfsKenneth R Westerback
on 4096-byte sector disks. No-op on 512-byte sector disks. Adhering to the bedrock idea that ffs will *never* use anything but 512-byte block disk addressing (a.k.a. daddr_t), and believing that the 'fake' bread()/bwrite() functions should always be using 512-btye block numbers like their kernel big brothers, nuke the computed dev_bsize and use DEV_BSIZE for conversions to/from byte offsets. Spotted and various fixes tested by David Vasek. Still to fix: scanning for superblocks on 4K disks. ok otto@
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-11-11incorrect %lld for an intTheo de Raadt
2013-11-05Replace direct references to p_size, p_offset and d_secperunit withKenneth R Westerback
DL_[GET|SET]PSIZE(), DL_[GET|SET]POFFSET(), DL_[GET|SET]DSIZE() in order to get|set correct value that includes the high bits of the value.
2013-11-03Add missing (long long) cast of variable, (long long) castsKenneth R Westerback
for defines fragnum, fsbtodb, cgsblock, and cgdmin.
2013-11-02No need to cast constants or simple variables to (daddr_t). UseKenneth R Westerback
(u_int64_t) instead of (daddr_t) when casting a variable in an expression passed to DL_SETDSIZE(). Change a variable counting open files from daddr_t to int64_t. ok deraadt@ with the tweak to fix that pesky expression.
2013-11-01Sprinkle (long long) casts where %lld is being used to print daddr_tKenneth R Westerback
variables. Some random whitespace/knf repairs encountered on the way. ok miod@ on inspection, feedback & more suggestions from millert@