summaryrefslogtreecommitdiffstats
path: root/disk-utils/fdisk.c
Commit message (Collapse)AuthorAgeFilesLines
* fdisk: initialize buffers for get_user_reply() [coverity scan]Karel Zak2019-05-141-2/+2
| | | | | | It's probably unnecessary, but better be safe than sorry. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate version printing and close_stdout()Karel Zak2019-04-161-3/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: make partition types uses more robustKarel Zak2019-01-101-3/+8
| | | | | | | | * report failed partition type parsing * make sure partition types code (from user reply) for MBR is hex Reported-by: Jonny Grant <jg@jguk.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: support CTRL+C on change-partition-type dialogKarel Zak2019-01-101-4/+11
| | | | | Reported-by: Jonny Grant <jg@jguk.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: Accept negative numbers for last sector inputAwal Garg2018-07-311-0/+2
| | | | | | | | [kzak@redhat.com: - add note to the man page - add '-' to the dialog query - cleanup functions names and libfdisk.sym] Signed-off-by: Karel Zak <kzak@redhat.com>
* nls: remove translation stringsSami Kerola2018-05-281-1/+1
| | | | | | | | | | While looking earlier commit I noticed everything but formatting was removed from a message in namei.c file. That inspired me to look if there are more strings that does not need translation project attention. This change removes at least some of them, if not all. Reference: e19cc7b65b31c57f0fe9cb73c9afad5197796f82 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: fix typo in debug stringVaclav Dolezal2018-05-091-1/+1
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: fix compiler warning [-Wmaybe-uninitialized]Karel Zak2018-05-031-1/+1
| | | | | Reported-by: L A Walsh <lkml@tlinx.org> Signed-off-by: Karel Zak <kzak@redhat.com>
* include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()Karel Zak2018-01-171-1/+1
| | | | | | | Let's make it possible to use debug.h without environment variables. Suggested-by: J William Piggott <elseifthen@gmx.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: use strutils to trim whitespace from inputVaclav Dolezal2017-08-291-6/+1Star
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: fix copy from readline and whitespace strippingVaclav Dolezal2017-08-281-3/+3
| | | | | | | | | | | | | | | | | | | | | Bug fixed: --- 678: fdisk: ASK: asking for number ['Partition number', <1,4>, default=1, range: 1-4] 678: fdisk: ASK: asking for user replay [interactive] Partition number (1-4, default 1): 12345 678: fdisk: ASK: user's reply: >>>12345<<< Value out of range. 678: fdisk: ASK: asking for user replay [interactive] Partition number (1-4, default 1): 1 678: fdisk: ASK: user's reply: >>>12345<<< Value out of range. 678: fdisk: ASK: asking for user replay [interactive] Partition number (1-4, default 1): 678: fdisk: ASK: user's reply: >>>22345<<< Value out of range. --- Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: minor fixes to make readline workVaclav Dolezal2017-08-281-3/+4
| | | | Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: fix readline interaction with signalsKarel Zak2017-08-241-58/+84
| | | | | | | | | | | | | The high-level readline API is crazy to use with signals. Fortunately the library provides low-level rl_callback_* API. In this case we can use poll() to wait for input and control all signals, etc. This patch also a little changes fdisk behavior on CTRL+C and CTRL+D. The signals does not kill fdisk, but forces fdisk to return to the main menu, if already in the main menu then exit. If the disk layout has been modified than ask "Do you really want to exit...". Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: handle SIGINT in dialogs as cancelVaclav Dolezal2017-08-241-2/+27
| | | | | | | [kzak@redhat.com: - use sig_atomic_t] Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add wrap_fgets() for getting user inputVaclav Dolezal2017-08-241-31/+26Star
| | | | | | | make function wrapping rl_fgets() and fputs()&fgets() to remove code duplication in get_user_reply(). Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
* fdisk: use fdisk_reread_changes()Karel Zak2017-07-141-0/+8
| | | | | | Let's make fdisk usable for disks where some partitions are mounted. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: consolidate macro style USAGE_HELP_OPTIONSRuediger Meier2017-06-291-2/+2
| | | | | | | | | changed in include/c.h and applied via sed: sed -i 's/fprintf.*\(USAGE_MAN_TAIL.*\)/printf(\1/' $(git ls-files -- "*.c") sed -i 's/print_usage_help_options\(.*\);/printf(USAGE_HELP_OPTIONS\1);/' $(git ls-files -- "*.c") Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: introduce print_usage_help_options()Ruediger Meier2017-06-271-2/+1Star
| | | | | | | | | | | | Consolidate --help and --version descriptions. We are now able to align them to the other options. We changed include/c.h. The rest of this patch was generated by sed, plus manually setting the right alignment numbers. We do not change anything but white spaces in the --help output. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* misc: never use usage(stderr)Ruediger Meier2017-06-261-14/+17
| | | | | | | Here we fix all cases where we have usage(FILE*) functions. Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* fdisk: fix type dialogKarel Zak2017-05-111-2/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk, sfdisk: avoid non-ANSI function declarations [smatch scan]Sami Kerola2017-03-141-0/+1
| | | | | | | | | | | | | | | Adding _FUNCTION_DEF definition will exclude compatibility type definitions that do include void key word in empty argument list. /usr/include/readline/rltypedefs.h:35:23: warning: non-ANSI function declaration of function 'Function' These functions has been replaced by set of new ones in readline 4.2 (April 2001), and removed in 6.3 (February 2014). Reference: https://cnswww.cns.cwru.edu/php/chet/readline/CHANGES Rererence: https://blueslugs.com/blog/2016-10-23-updating-cppfunction-in-old-readline-consumers/ Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* fdisk: improve --wipe functionalityKarel Zak2017-02-141-18/+27
| | | | | | | | | * always (except --wipe=never) wipe old partition tables * improve warn messages * improve man page Addresses: https://github.com/karelzak/util-linux/issues/410 Signed-off-by: Karel Zak <kzak@redhat.com>
* Use --help suggestion on invalid optionKarel Zak2016-12-191-1/+1
| | | | | | | | The current default is to print all usage() output. This is overkill in many case. Addresses: https://github.com/karelzak/util-linux/issues/338 Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: don't be silent when list non-existing deviceKarel Zak2016-12-131-2/+6
| | | | | Addresses: https://github.com/karelzak/util-linux/issues/376 Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: use PAGER for 'l' command.Karel Zak2016-08-261-0/+6
| | | | | | | The list of the partition types is too long. Let's try to use $PAGER. Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: make -l <dev ...> behaves like fdisk -lThierry Vignaud2016-07-141-1/+6
| | | | | | aka having the same spacing between disks Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: Fix various typosSebastian Rasmussen2016-05-311-1/+1
| | | | | | | Fix various typos in error messages, warnings, debug strings, comments and names of static functions. Signed-off-by: Sebastian Rasmussen <sebras@gmail.com>
* fdisk: add --wipe-partitions=auto|never|defaultKarel Zak2016-05-041-1/+10
| | | | | | | | | | | | | 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: fix the grammar of an option descriptionBenno Schulenberg2016-03-171-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* fdisk, cfdisk, sfdisk: improve the grammar of three messagesBenno Schulenberg2016-03-161-2/+2
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* sfdisk, fdisk: add fflush()Karel Zak2016-03-101-0/+2
| | | | | | | Let's add fflush(stdout) before we print to stderr to make output order more deterministic. Signed-off-by: Karel Zak <kzak@redhat.com>
* misc: again fixing many printf format stringsRuediger Meier2016-03-071-10/+15
| | | | | | | | | | | | | | | | | | | 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>
* fdisk: remove unused include sysfs.hRuediger Meier2016-03-071-1/+0Star
| | | | Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
* 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>
* fdisk: add --wipeKarel Zak2016-02-181-1/+27
| | | | | | | | | | | | | | This patch changes fdisk behavior and it wipes foreign signatures from the device to avoid collisions. The wipe functionality is automatically enabled in the interactive mode only (user is always warned about it), otherwise it's possible to control all by --wipe <auto|never|always>. The program does not change behavior when executed in scripts (echo <something> | fdisk), the option "--wipe=always" is required to enable in this case. Signed-off-by: Karel Zak <kzak@redhat.com>
* Fix trivial typosYuri Chornoivan2015-08-251-1/+1
|
* textual: adjust grammar and punctuation of some messagesBenno Schulenberg2015-08-031-1/+1
| | | | | | | Also equalize three messages to one other one, and fix a typo in USE_COLORS_BY_DEFAULT. Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* fdisk: value is never read [clang analyze]Karel Zak2015-07-291-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: init libsmartcols debugKarel Zak2015-07-271-0/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: fix fdisk_label_parse_parttype() for unknown typesKarel Zak2015-07-151-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: differentiate between +<sector> and +<size>{M,G,...}Karel Zak2015-06-101-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* libfdisk: (gpt) make it possible to create really small partitionsKarel Zak2015-06-081-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: provide more information by 'i'nfo commandKarel Zak2015-05-111-6/+4Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add the 'i'nfo commandJean-Loup 'clippix' Bogalho2015-05-111-0/+44
| | | | | | | Add the 'i'nfo command to fdisk that prints details about a specific partition. Details are everything the function 'fdisk_label_get_field' can return. Signed-off-by: Jean-Loup 'clippix' Bogalho <clippix@lse.epita.fr>
* fdisk: fix typoKarel Zak2015-04-131-1/+1
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add --protect-bootKarel Zak2015-04-131-1/+6
| | | | | | | | Now fdisk erases the begin of the device when create a new disk label, it seems like disadvantage for some use-cases. Reported-by: Jean-Loup 'clippix' Bogalho <clippix@lse.epita.fr> Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: fix readline wrapperKarel Zak2015-03-251-1/+2
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* fdisk: add GNU Readline support to fdiskKarel Zak2015-03-251-14/+50
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* colors: cleanup man pages, add hint to usage()Karel Zak2015-02-251-0/+3
| | | | | | | | cfdisk, fdisk, calm dmesg and hexdump Signed-off-by: Karel Zak <kzak@redhat.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* rpmatch: use symbolic value when evaluation return codesSami Kerola2015-02-241-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>