diff options
author | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-12 17:55:51 +0000 |
---|---|---|
committer | aldot <aldot@69ca8d6d-28ef-0310-b511-8ec308f3f277> | 2006-04-12 17:55:51 +0000 |
commit | 00657c96b9b3963230d89ccc3dc2959d034673e7 (patch) | |
tree | 0e4c34863628d79fdad0c6217f4deb0ca0a91c33 /util-linux/mkswap.c | |
parent | fa6199c4ed8fdbb6901f43a06fb22d37e6e9b9e1 (diff) | |
download | busybox-w32-00657c96b9b3963230d89ccc3dc2959d034673e7.tar.gz busybox-w32-00657c96b9b3963230d89ccc3dc2959d034673e7.tar.bz2 busybox-w32-00657c96b9b3963230d89ccc3dc2959d034673e7.zip |
- 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.
git-svn-id: svn://busybox.net/trunk/busybox@14833 69ca8d6d-28ef-0310-b511-8ec308f3f277
Diffstat (limited to '')
-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) | |||
258 | int fd; | 258 | int fd; |
259 | long size; | 259 | long size; |
260 | 260 | ||
261 | if ((fd = open(file, O_RDONLY)) < 0) /* TODO: bb_xopen3 */ | 261 | fd = bb_xopen(file, O_RDONLY); |
262 | bb_perror_msg_and_die("%s", file); | ||
263 | if (ioctl(fd, BLKGETSIZE, &size) >= 0) { | 262 | if (ioctl(fd, BLKGETSIZE, &size) >= 0) { |
264 | size /= pagesize / 512; | 263 | size /= pagesize / 512; |
265 | } else { | 264 | } else { |
@@ -342,8 +341,8 @@ int mkswap_main(int argc, char **argv) | |||
342 | PAGES * goodpages); | 341 | PAGES * goodpages); |
343 | } | 342 | } |
344 | 343 | ||
345 | DEV = open(device_name, O_RDWR); | 344 | DEV = bb_xopen(device_name, O_RDWR); |
346 | if (DEV < 0 || fstat(DEV, &statbuf) < 0) | 345 | if (fstat(DEV, &statbuf) < 0) |
347 | bb_perror_msg_and_die("%s", device_name); | 346 | bb_perror_msg_and_die("%s", device_name); |
348 | if (!S_ISBLK(statbuf.st_mode)) | 347 | if (!S_ISBLK(statbuf.st_mode)) |
349 | check = 0; | 348 | check = 0; |