aboutsummaryrefslogtreecommitdiff
path: root/util-linux/mkswap.c
diff options
context:
space:
mode:
authorBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
committerBernhard Reutner-Fischer <rep.dot.nop@gmail.com>2006-04-12 17:55:51 +0000
commitdac7ff15b7d32deeeef3d9665744fc5774c21d70 (patch)
tree0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /util-linux/mkswap.c
parent79865bc5077cf6d17b27e9599921d4c85b1575fd (diff)
downloadbusybox-dac7ff15b7d32deeeef3d9665744fc5774c21d70.tar.gz
- patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it. Also use shorter boilerplate while at it.
Diffstat (limited to 'util-linux/mkswap.c')
-rw-r--r--util-linux/mkswap.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c
index ce123e502..32021fe08 100644
--- a/util-linux/mkswap.c
+++ b/util-linux/mkswap.c
@@ -258,8 +258,7 @@ static inline long get_size(const char *file)
int fd;
long size;
- if ((fd = open(file, O_RDONLY)) < 0) /* TODO: bb_xopen3 */
- bb_perror_msg_and_die("%s", file);
+ fd = bb_xopen(file, O_RDONLY);
if (ioctl(fd, BLKGETSIZE, &size) >= 0) {
size /= pagesize / 512;
} else {
@@ -342,8 +341,8 @@ int mkswap_main(int argc, char **argv)
PAGES * goodpages);
}
- DEV = open(device_name, O_RDWR);
- if (DEV < 0 || fstat(DEV, &statbuf) < 0)
+ DEV = bb_xopen(device_name, O_RDWR);
+ if (fstat(DEV, &statbuf) < 0)
bb_perror_msg_and_die("%s", device_name);
if (!S_ISBLK(statbuf.st_mode))
check = 0;