summaryrefslogtreecommitdiffstats
path: root/disk-utils
Commit message (Collapse)AuthorAgeFilesLines
* cfdisk: use libsmartcols ASCII for non-widechar environmentKarel Zak2016-06-031-0/+4
| | | | | Reported-by: Stanislav Brabec <sbrabec@suse.cz> Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck.minix: fix endless loop and out of stackKarel Zak2016-06-011-0/+16
| | | | | | | | | It seems there is no elegant way how to recovery if a directory i_zone (and i_size) is out of reality. Let's require human interaction to avoid endless loop when executed with --auto, etc. Addresses: https://github.com/karelzak/util-linux/issues/228 Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: Fix typo RequiredPartiton -> RequiredPartitionSebastian Rasmussen2016-05-311-2/+2
| | | | | | | | This typo fix is backwards compatible in that fdisk will accept both the GPT attribute RequiredPartition and RequiredPartiton with the typo. Update documentation and tests to all use the new attribute name. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* misc: Fix various typosSebastian Rasmussen2016-05-319-21/+21
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* docs: Fix various typosSebastian Rasmussen2016-05-313-4/+4
| | | | Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* fsck.minix: Verify more fields in super-block.Tobias Stoeckmann2016-05-311-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | The field s_ninodes in super-block is used for memory allocation and division without verifications. The memory allocation increments the unchecked value by 1, making it vulnerable to an integer overflow on 32 bit systems with minix 3 file systems. I did not find a (good) way to exploit this by crafting a malicious file system, so I consider it as a reliability issue. If it's 0, a division by zero occurs when "-v" has been used. A filesystem without any inodes is definitely wrong, because it means that there's not even the root inode, which is accessed unchecked later on. The field s_firstdatazone has to be checked against s_(n)zones. If it is larger than the highest allowed index, the file system is definitely corrupted -- hard to say which value is wrong though, therefore I decided to simply call die(). A maliciously created file system could do more harm in this way: single bits inside the memory area could be flipped because range checks would fail. Hard to consider it as a security issue though, because these addresses are not arbitrarily accessible without very careful crafting (if at all possible). [kzak@redhat.com: - fix compiler warning (cast get_nzones()) [-Wsign-compare]] Signed-off-by: Karel Zak <kzak@redhat.com>
* man pages: fix spacing between man page name & section numberMike Frysinger2016-05-202-3/+3
| | | | | | Most have standardized correctly, but fix a few latent ones. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* fdisk: Add support for altering GPT sizeSassan Panahinejad2016-05-181-0/+8
| | | | Adds an options (l) to the GPT menu to resize the GPT.
* sfdisk: exit with error if rereading partition table failsVictor Dodon2016-05-051-1/+1
| | | | | | | Use the return value of fdisk_reread_partition_table in write_changes so that sfdisk exits with error if re-reading the partition table fails. Signed-off-by: Victor Dodon <dodonvictor@gmail.com>
* build-sys: remove obsolete [cs]fdisk LDADDsKarel Zak2016-05-042-29/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk: add --wipe-partitions=auto|never|defaultKarel Zak2016-05-043-38/+85
| | | | | | | | | | | | | The option allows to remove filesystes/RAIDs from newly created partitions before the partition table is updated (and partition device created). The default is "auto" in this case wipe is enabled in interactive mode only and user's confirmation (yes/no dialog) is required. Note that keep filesystem signature on partition is pretty valid use-case, so we don't erase anything by default. Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add --wipe-partitions=auto|never|defaultKarel Zak2016-05-044-2/+61
| | | | | | | | | | | | | The option allows to remove filesystes/RAIDs from newly created partitions before the partition table is updated (and partition device created). The default is "auto" in this case wipe is enabled in interactive mode only and user's confirmation (yes/no dialog) is required. Note that keep filesystem signature on partition is pretty valid use-case, so we don't erase anything by default. Signed-off-by: Karel Zak <kzak@redhat.com>
* fsck: fix racing between unlock/unlink and openYuriy M. Kaminskiy2016-04-221-1/+0Star
| | | | | | | | | | | | | | | | | | | | | | | | | Process A Process B Process C open() [creates file] lock() [succeed] open() [open existing] lock()... running() close() [...succeed] unlink() running() open() [creates file] {BAD!} lock() [succeed] {BAD!} running() {BAD!} close() Cons: leaves empty (unlocked/harmless) .lock files in /run/fsck/ Signed-off-by: Yuriy M. Kaminskiy <yumkam@gmail.com>
* mkswap: tolerate ENOTSUP when failing to relabelLubomir Rintel2016-04-181-1/+1
| | | | | | | | | It might be that the underlying filesystem just doesn't support SELinux labeling. This fixes creating swap on vfat live media: # livecd-iso-to-disk.sh --msdos --swap-size-mb 666 ... Signed-off-by: Lubomir Rintel <lkundrak@v3.sk>
* fdisk: remove dead assignment [clang analyze]Karel Zak2016-03-291-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* partx: fix --nr usageKarel Zak2016-03-222-15/+46
| | | | | Reported-by: Serge van den Boom <serge+util-linux@vdboom.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* docs: miscellaneous tiny tweaks of man pagesBenno Schulenberg2016-03-171-4/+4
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* fdisk: fix the grammar of an option descriptionBenno Schulenberg2016-03-171-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* mount, umount, swapon, fsck, lsblk, findmnt: harmonize six error messagesBenno Schulenberg2016-03-161-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* fdisk, cfdisk, sfdisk: improve the grammar of three messagesBenno Schulenberg2016-03-163-5/+5
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sfdisk: improve the wording of seven error messagesBenno Schulenberg2016-03-161-7/+7
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* Merge branch 'travis-osx' of https://github.com/rudimeier/util-linuxKarel Zak2016-03-141-2/+2
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'travis-osx' of https://github.com/rudimeier/util-linux: travis: add OSX build travis: switch to Ubuntu 14.04 Trusty build-sys: improve uuidd and script build conditions build-sys: use AC_PROG_MKDIR_P and remove a few gnuisms build-sys: add missing "not found" strings build-sys: fix again UL_SCANF_TYPE_MODIFIER tests: don't use system's mount commands tests: improve skipping of old btrfs-tools tests: remove invalid argument in libmount/debug tests: skip old socat silently misc: fix icc/clang compiler warnings misc: fix printf i386 compiler warnings
| * misc: fix icc/clang compiler warningsRuediger Meier2016-03-131-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | clang warning: libmount/src/tab.c:1833:6: warning: variable 'rc' is used uninitialized whenever 'if' condition is true [-Wsometimes-uninitialized] if (!mpc) ^~~~ icc printf warnings: libmount/src/monitor.c(348): warning #2279: printf/scanf format not a string literal and no format arguments DBG(MONITOR, ul_debugobj(mn, status == 1 ? " success" : " nothing")); ^ login-utils/vipw.c(348): warning #2279: printf/scanf format not a string literal and no format arguments : _("You are using shadow passwords on this system.\n")); ^ icc enum warnings: disk-utils/fdisk-menu.c(150): warning #188: enumerated type mixed with another type .exclude = FDISK_DISKLABEL_GPT | FDISK_DISKLABEL_BSD, ^ libsmartcols/src/table_print.c(750): warning #188: enumerated type mixed with another type &width, align, ^ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | isosize: stop unmeaningful printing errno messageSami Kerola2016-03-141-1/+1
|/ | | | | | | | | | | Earlier printout had strange looking 'Success'. $ isosize --sectors /dev/urandom isosize: /dev/urandom: might not be an ISO filesystem isosize: 733error: le=-1971599244 be=1633181607: Success ... Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* misc: remove duplicate includesKarel Zak2016-03-101-1/+0Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* sfdisk, fdisk: add fflush()Karel Zak2016-03-102-0/+4
| | | | | | | Let's add fflush(stdout) before we print to stderr to make output order more deterministic. Signed-off-by: Karel Zak <kzak@redhat.com>
* Merge branch 'port-osx' of https://github.com/rudimeier/util-linuxKarel Zak2016-03-091-1/+1
|\ | | | | | | | | | | | | | | * 'port-osx' of https://github.com/rudimeier/util-linux: fdisk: fix warning, uninitialized variable logger: fix compiler warning, const facilitynames include/bitops: avoid fallbacks for more systems include/bitops: add casts to bswap functions
| * fdisk: fix warning, uninitialized variableRuediger Meier2016-03-081-1/+1
| | | | | | | | | | | | This was a typo in 4afb337e. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | include: move sys/sysmacros.h to c.hKarel Zak2016-03-082-7/+1Star
| | | | | | | | | | | | | | The file is no portable (#ifdef HAVE_SYS_SYSMACROS_H is necessary), but needed on many places. It seems better to keep it in c.h. Signed-off-by: Karel Zak <kzak@redhat.com>
* | Revert "include sysmacros.h where used"Karel Zak2016-03-083-3/+0Star
| | | | | | | | This reverts commit 46a40c018438b7b2b25083a5e5a4a21055a0c1e9.
* | sfdisk: adjust more wordings and formatting in the man pageBenno Schulenberg2016-03-081-29/+34
| | | | | | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | fdisk, sfdisk: adjust the wording of the --wipe optionBenno Schulenberg2016-03-082-12/+14
| | | | | | | | | | | | | | Use "when" as argument, to match the argument of --color, that can have the same three values. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | fdisk, sfdisk: adjust some formatting in the man pagesBenno Schulenberg2016-03-082-5/+5
| | | | | | | | | | | | | | Only the optional argument should be in italics, the literal = should be bold. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* | include sysmacros.h where usedMike Frysinger2016-03-083-0/+3
|/ | | | | | | | BSD/Linux systems stick major/minor/makedev in sysmacros.h. Newer Linux libraries have been moving away from including sysmacros.h implicitly via sys/types.h, so include it directly. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* misc: never cast void* from malloc(3) and friendsRuediger Meier2016-03-071-1/+1
| | | | | | | | | | Such cast could hide serious compiler warnings in case we are missing includes (e.g. <stdlib.h> or "xalloc.h"). See http://stackoverflow.com/questions/605845/do-i-cast-the-result-of-malloc Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: again fixing many printf format stringsRuediger Meier2016-03-075-23/+33
| | | | | | | | | | | | | | | | | | | This is again a huge patch regarding printf format strings to fix compiler warnings seen on clang/OSX. I'm trying to follow these rules strictly: #type #format #cast uintmax_t %ju - intmax_t %jd - uint64_t PRIu64 - int64_t PRId64 - size_t %zu - ssize_t %zd - ino_t %ju (uintmax_t) off_t %jd (intmax_t) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* wipefs, sfdisk: include libgen.h for basename(3p)Ruediger Meier2016-03-071-0/+1
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Merge branch 'fix-minix' of https://github.com/rudimeier/util-linuxKarel Zak2016-03-072-5/+5
|\ | | | | | | | | | | | | | | | | | | * 'fix-minix' of https://github.com/rudimeier/util-linux: tests: minix, add a useful non-root check tests: fix minix tests for big endian mkfs.minix: fix v2/v3 .badblocks inode number for big endian fsck.minix: fix v3 version offset tests: minix, some corrections and cleanup tests: minix, use hexdump instead of md5sum
| * mkfs.minix: fix v2/v3 .badblocks inode number for big endianRuediger Meier2016-03-031-3/+2Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | For minix v2/v3 on big endian systems the inode number of the unwanted ".badblocks" file was not set to zero. This was introduced when v3 was added in a2657ae3. Actually it did not seem to cause any problems but since we zero it out at all we should do it correctly. Now we zero out the whole directory entry (inclusive ".badblocks" file name, also for v1). Unfortunately we have to update the test data checksums. CC: Davidlohr Bueso <davidlohr@hp.com> Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * fsck.minix: fix v3 version offsetRuediger Meier2016-03-031-2/+3
| | | | | | | | | | | | | | Our test-suite discoverd it on big endian systems, but it was also broken on little endian for inode numbers > 0xffff. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | fdisk: remove unused include sysfs.hRuediger Meier2016-03-071-1/+0Star
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | lib: remove openat fallback functions (include/at.h)Ruediger Meier2016-03-071-2/+1Star
| | | | | | | | | | | | | | | | | | | | | | | | | | | | I have validated that we are still compatible at least back to - openSUSE 11.4 - SLE 11 - RHEL/CentOS 6 - OSX 10.10.x, (Xcode 6.3) - FreeBSD 10.2 Confirmed incompatibility: - OSX 10.9.x, (Xcode 6.2) Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | misc: safer (and uniform) handling of return valueYuriy M. Kaminskiy2016-03-071-1/+1
| | | | | | | | | | | | When `rc` is `INT_MAX`, `rc + 1` result in signed integer overflow. Signed-off-by: Karel Zak <kzak@redhat.com>
* | fdisk: fix warning, incompatible pointer types passing 'uint64_t *'Ruediger Meier2016-02-291-2/+2
|/ | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: fix compiler warnungs (unsigned/signed)Ruediger Meier2016-02-231-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These ones should be fixed: libblkid/src/probe.c:393:39: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/probe.c:907:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/probe.c:1221:8: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:540:47: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1043:14: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1056:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1057:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1061:38: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/partitions/partitions.c:1199:27: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/partitions/partitions.c:1410:26: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/partitions/partitions.c:1431:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libblkid/src/superblocks/linux_raid.c:151:8: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] libblkid/src/superblocks/linux_raid.c:155:2: warning: comparison of unsigned expression < 0 is always false [-Wtype-limits] libblkid/src/superblocks/superblocks.c:375:30: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libblkid/src/superblocks/xfs.c:141:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libsmartcols/src/table.c:333:24: warning: signed and unsigned type in conditional expression [-Wsign-compare] libsmartcols/src/table.c:344:25: warning: signed and unsigned type in conditional expression [-Wsign-compare] libsmartcols/src/table_print.c:753:9: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/ask.c:364:21: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/utils.c:33:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/context.c:435:56: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/context.c:730:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/script.c:557:10: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/dos.c:1791:17: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] libfdisk/src/gpt.c:813:42: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] misc-utils/logger.c:408:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:140:13: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:551:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] disk-utils/partx.c:640:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare] Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* build-sys: always add AM_CFLAGSRuediger Meier2016-02-231-2/+2
| | | | | | | | We were missing our nice compliler warnings for many programs and libs. See next commits how many trivial and non-trival warnings have to be fixed. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* Merge branch 'port-osx' of https://github.com/rudimeier/util-linuxKarel Zak2016-02-195-3/+4
|\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 'port-osx' of https://github.com/rudimeier/util-linux: include: fix sys/sysinfo.h libblkid: don't include endian.h lib: fix ismounted includes for FreeBSD lib: remove unused variable lsns: use xcalloc() include: remove unused mntent.h include: check for sys/sysmacros.h lib: define LOGIN_NAME_MAX fallback include: provide MAP_ANONYMOUS on OSX lib: rename strmode() and setmode() tests: fix ts_option helpers build-sys: fix [g]libtoolize version for OSX build-sys: check linker support for version scripts build-sys: portable usage of find command travis: minor cleanup
| * include: remove unused mntent.hRuediger Meier2016-02-183-3/+0Star
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
| * include: check for sys/sysmacros.hRuediger Meier2016-02-182-0/+4
| | | | | | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* | cfdisk: wipe device if create a new labelKarel Zak2016-02-181-0/+8
| | | | | | | | Signed-off-by: Karel Zak <kzak@redhat.com>