summaryrefslogtreecommitdiffstats
path: root/fdisk/sfdisk.c
diff options
context:
space:
mode:
authorForest Bond2010-10-05 03:01:30 +0200
committerKarel Zak2010-10-07 10:22:02 +0200
commit628e30197e106f0dea32aa01e9a43c4cab0b07fe (patch)
tree95210d64eeee56ff8e964eb32c23e09dbc32920a /fdisk/sfdisk.c
parentcolumn: update manual page to match column switches (diff)
downloadkernel-qcow2-util-linux-628e30197e106f0dea32aa01e9a43c4cab0b07fe.tar.gz
kernel-qcow2-util-linux-628e30197e106f0dea32aa01e9a43c4cab0b07fe.tar.xz
kernel-qcow2-util-linux-628e30197e106f0dea32aa01e9a43c4cab0b07fe.zip
sfdisk: save errno before calling perror
errno is saved into a local variable to avoid it getting trampled by perror before it is checked to determine the return value. This issue seems quite rare, but I have seen it when running sfdisk via gksudo and using the --quiet command-line option. From what I can tell, this combination triggers loading of translations in perror, which (at least on my machine) ends up changing the value of errno. Signed-off-by: Forest Bond <forest@alittletooquiet.net>
Diffstat (limited to 'fdisk/sfdisk.c')
-rw-r--r--fdisk/sfdisk.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/fdisk/sfdisk.c b/fdisk/sfdisk.c
index 6432b25c0..fd2f27eb1 100644
--- a/fdisk/sfdisk.c
+++ b/fdisk/sfdisk.c
@@ -784,10 +784,13 @@ reread_ioctl(int fd) {
errno = ENOSYS;
#endif
{
+ /* perror might change errno */
+ int err = errno;
+
perror("BLKRRPART");
/* 2.6.8 returns EIO for a zero table */
- if (errno == EBUSY)
+ if (err == EBUSY)
return -1;
}
return 0;