summaryrefslogtreecommitdiffstats
path: root/sbin/fsck_msdos (follow)
Commit message (Collapse)AuthorAgeFilesLines
* When system calls indicate an error they return -1, not some arbitraryderaadt2019-06-281-4/+4
| | | | | | 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.
* Use unveil(2). These programs fit together in various strange ways,deraadt2018-09-242-2/+7
| | | | | so if a problem is encountered with this the whole set needs backout and study.
* Avoid the possibility of accessing an array out of bounds.jsg2017-06-271-1/+3
| | | | Found with cppcheck. ok krw@
* Rename BIOS parameter block field from bsPBP to bsBPB. This typobluhm2016-10-101-2/+2
| | | | | has been fixed in FreeBSD in 2002. No binary change. From Alexander von Gernler; OK krw@
* Another misplaced pledge disklabel that needs to be removed because oftb2016-05-281-4/+1
| | | | | | | a DIOCGPDINFO that could be applied to a non-disk and thus cause a crash. After that ioctl, the program continues with pledge "stdio". ok beck semarie
* Remove NULL-checks before free(). ok tb@mmcc2015-12-102-8/+5
|
* Use pledge "disklabel" as needed. The theory here is these tools become morederaadt2015-11-231-1/+5
| | | | | resistant against memory correctup, if a corrupt filesystem is given to them. ok krw
* Since the fsck_* programs now only handle one filesystem, this createsderaadt2015-10-141-1/+5
| | | | | | | | | | 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
* Only accept one filesystem/device as argument for checking. Few peoplederaadt2015-10-142-18/+12
| | | | | | 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
* Mark ask() as printf-like; split up a pwarn() with variable number of specifiersguenther2015-09-273-12/+12
| | | | ok beck@ millert@
* <stdlib.h> is included, so do not need to cast result fromderaadt2015-08-201-3/+3
| | | | | malloc, calloc, realloc* ok krw millert
* document "F" in interactive mode, like for fsck.8;jmc2015-07-271-2/+13
| | | | | | from michael mcconville ok deraadt
* Replace <sys/param.h> with <limits.h> and other less dirty headers wherederaadt2015-01-163-8/+8
| | | | | | | | | 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)
* Nuke some obvious #include duplications.krw2014-11-181-2/+1
| | | | ok espie@ deraadt@ millert@ tedu@
* Remove redundant check and wrong fix: fat.c checks already take caretobias2014-07-111-20/+4
| | | | | | | about cluster chains. If the user didn't want to fix them at that time, he asks for trouble -- and these checks didn't help in all cases either. discussed with and ok krw@
* Uninitialized values (-1) in FSInfo are perfectly valid.tobias2014-07-101-4/+6
| | | | | | Merged from NetBSD revision 1.24. ok krw@ (who came up with the same diff)
* Avoid out of boundary access when checking invalid long filenames.tobias2014-07-101-1/+9
| | | | | | | Addressed by NetBSD in revision 1.24, but instead of ignoring the filename, consider it invalid -- because it is. ok krw@, tedu@
* Validate file system information which are critical for fsck_msdos operation.tobias2014-07-101-2/+13
| | | | ok krw@
* Validate number of FATs.tobias2014-07-101-1/+5
| | | | | | Merged from Android (commitid 6c29bbe8d58e6fe8755935a04166ecf82ff31f47) ok krw@
* Merge memory leak fix from NetBSD's dir.c revision 1.20, but actuallytobias2014-07-092-9/+10
| | | | | | release all reserved memory chunks in all error cases. with input by and ok tedu@, ok deraadt@
* Always keep length of cluster chain up to date, otherwise the drop oftobias2014-06-182-5/+18
| | | | | | superfluous clusters can lead to out of boundary access. ok krw@
* Merge NetBSD commit:tobias2014-06-168-65/+9
| | | | | | Move to 2 clause license, approved by Wolfgang Solfrank. ok deraadt@, krw@
* Avoid infinite loop if cluster chain is a cyclic list.tobias2014-06-141-4/+12
| | | | | | | Inspired by Android's commit b6ee08aadb580341a4d80943741b80de16a88b5d, but fixing the actually offending cluster, not a random one. ok krw@
* Fix memory leaks in bootblock handling.tobias2014-06-141-29/+42
| | | | ok krw@
* Fix regression of 1.16: write fsinfo, not block into FSInfo region.tobias2014-06-141-2/+2
| | | | ok krw@
* Fix regression of 1.20 by properly incrementing pointer.tobias2014-06-141-3/+3
|
* Fix off by one when writing FAT for FAT12 filesystems.tobias2014-06-101-7/+9
| | | | ok deraadt@
* Fix possible out of boundary access if filesystem is full or corrupt.tobias2014-06-091-2/+3
| | | | | | Merged from Android (commit id 59ae828834dc177c74775cf36cafda4da9927bd9). ok deraadt@
* Add missing \n after a warning.rapha2013-08-121-2/+2
| | | | ok miod@
* Make fsck_msdos work with non-512-byte sector devices. Problem notedkrw2012-03-314-58/+128
| | | | | | | | | | | | by and fixes tested by Alexey Vatchenko. Add a bunch of tests and error messages so whatever media/devices this breaks will be more easily fixed. Ignore invalid signatures since we have other checks and many media have missing signatures. Use character device to read disk even when called directly.
* add some off_t and ssize_t love; ok stsp millertderaadt2010-12-181-16/+25
|
* Add missing util.h include for opendev()millert2010-12-171-1/+2
|
* Switch fsck_msdos(8) to opendev(3) so that it can handle disklabel UIDs.jsing2010-11-172-14/+19
|
* Print the real device name followed by the disklabel UID in parenthesisjsing2010-08-121-2/+2
| | | | | | | when fsck is run against a disklabel UID. This allows a user to determine which device is really being scanned. ok krw@
* rcsid[] and sccsid[] and copyright[] are essentially unmaintained (andderaadt2009-10-275-29/+5
| | | | | | | 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
* Check reads and lseek correctly for unsigned return; ok krw@ian2008-02-072-23/+27
|
* sort flags in both synopsis and usagesobrado2007-12-301-3/+3
| | | | ok jmc@
* use calloc() to avoid malloc(n * m) overflows; checked by djm canacar jsgderaadt2007-09-021-4/+5
|
* convert to new .Dd format;jmc2007-05-311-2/+2
|
* Fix memory leak, from Charles Longeau, many okayspedro2006-11-111-3/+5
|
* Only compare important parts of the boot block with the backup copy,tom2006-07-191-4/+19
| | | | | | | | | | since some vendor utilities will change one without changing the other. Raised most recently by Nick Guenther; fix is similar to what is in NetBSD, but includes an idea from Steven E. Kalbach <kalbachs (at) kalbachsoft (dot) com>, posted to bugs@ over 5 years ago. ok tedu@, pedro@
* newline fix + s/perror/xperror since we arethib2006-05-274-30/+30
| | | | | | using a home rolled version. ok pedro@
* malloc(x * y) -> calloc(x, y) from adobriyan AT gmail.com, with tweaksdjm2006-04-021-5/+3
| | | | suggested by kjell@; ok otto@ pat@ millert@ jaredy@
* when asking y or n, accept "F" which forces yes from the on. i havederaadt2006-03-301-3/+7
| | | | | wished for this for 10+ year, but always forgotten to make the change after cleaning up a nasty file system; ok pedro millert
* NetBSD Coverity CID 2302: Free fat if fatal error to avoid leak.dhill2006-03-201-3/+7
| | | | ok otto@ deraadt@
* sync usage outputjaredy2005-02-031-3/+3
|
* - simplify, normalize, and sync usage/synopsis formsjaredy2005-02-031-31/+31
| | | | | | | | | | | | | | - filesystem -> file system, for consistency - indent sections where applicable - mdoc, punctuation, grammar, etc. fixes - document SIGINFO to fsck_ffs - unify description of -n among documents - sprinkle xrefs all around - move parts relevant to fsck.8 from fsck_ffs.8 parts from NetBSD ok jmc
* some ansi; khalek@linuxgamers.netderaadt2004-07-175-118/+45
|
* spacesderaadt2003-07-294-13/+13
|
* snprintfderaadt2003-03-301-3/+3
|