projects
/
oweals
/
busybox.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make cp and mv optionally preserve hard links.
[oweals/busybox.git]
/
util-linux
/
freeramdisk.c
diff --git
a/util-linux/freeramdisk.c
b/util-linux/freeramdisk.c
index a2b17c6737b9daa31bdef62e4048584111bceb22..aabb5f98827641ed79ef3c6fa890f6a338c4158b 100644
(file)
--- a/
util-linux/freeramdisk.c
+++ b/
util-linux/freeramdisk.c
@@
-27,6
+27,7
@@
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <errno.h>
+#include <stdlib.h>
#include "busybox.h"
#include "busybox.h"
@@
-36,16
+37,15
@@
extern int
freeramdisk_main(int argc, char **argv)
{
extern int
freeramdisk_main(int argc, char **argv)
{
-
int
f;
+
FILE *
f;
if (argc != 2 || *argv[1] == '-') {
if (argc != 2 || *argv[1] == '-') {
-
usage(freeramdisk_usage
);
+
show_usage(
);
}
}
- if ((f = open(argv[1], O_RDWR)) == -1) {
- perror_msg_and_die("cannot open %s", argv[1]);
- }
- if (ioctl(f, BLKFLSBUF) < 0) {
+ f = xfopen(argv[1], "r+");
+
+ if (ioctl(fileno(f), BLKFLSBUF) < 0) {
perror_msg_and_die("failed ioctl on %s", argv[1]);
}
/* Don't bother closing. Exit does
perror_msg_and_die("failed ioctl on %s", argv[1]);
}
/* Don't bother closing. Exit does