diff options
author | Francesco Cosoleto | 2011-06-02 21:17:57 +0200 |
---|---|---|
committer | Karel Zak | 2011-06-08 13:09:18 +0200 |
commit | c60103a9f3e06fc1cd11f0a5ed83c0d12a631224 (patch) | |
tree | 360e7662ea0461798520ff65842206a3aa722e6d /sys-utils/fstrim.c | |
parent | tests: add lscpu dumps from three Dell's & a Xen (diff) | |
download | kernel-qcow2-util-linux-c60103a9f3e06fc1cd11f0a5ed83c0d12a631224.tar.gz kernel-qcow2-util-linux-c60103a9f3e06fc1cd11f0a5ed83c0d12a631224.tar.xz kernel-qcow2-util-linux-c60103a9f3e06fc1cd11f0a5ed83c0d12a631224.zip |
fstrim, setarch: replace error() with err()
This should improve a bit the portability as error() is a GNU extension and
util-linux provides fallbacks for err.h functions.
Fix compilation with icc, broken due to a reference to `__builtin_va_arg_pack'
in error.h using the -gcc default option.
Signed-off-by: Francesco Cosoleto <cosoleto@gmail.com>
Diffstat (limited to 'sys-utils/fstrim.c')
-rw-r--r-- | sys-utils/fstrim.c | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/sys-utils/fstrim.c b/sys-utils/fstrim.c index 42e5cb046..533a27426 100644 --- a/sys-utils/fstrim.c +++ b/sys-utils/fstrim.c @@ -32,8 +32,6 @@ #include <fcntl.h> #include <limits.h> #include <getopt.h> -#include <error.h> -#include <errno.h> #include <sys/ioctl.h> #include <sys/stat.h> @@ -141,11 +139,9 @@ int main(int argc, char **argv) if (fd < 0) err(EXIT_FAILURE, _("%s: open failed"), path); - if (ioctl(fd, FITRIM, &range)) { - int errsv = errno; - close(fd); - error(EXIT_FAILURE, errsv, _("%s: FITRIM ioctl failed"), path); - } + if (ioctl(fd, FITRIM, &range)) + err(EXIT_FAILURE, _("%s: FITRIM ioctl failed"), path); + if (verbose) printf(_("%s: %" PRIu64 " bytes was trimmed\n"), path, (uint64_t) range.len); |