diff options
author | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 17:55:51 +0000 |
---|---|---|
committer | Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> | 2006-04-12 17:55:51 +0000 |
commit | dac7ff15b7d32deeeef3d9665744fc5774c21d70 (patch) | |
tree | 0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /util-linux/mkswap.c | |
parent | 79865bc5077cf6d17b27e9599921d4c85b1575fd (diff) |
- 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.c | 7 |
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; |