projects
/
project
/
ubox.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
7c922b0
)
block: restore support for using swap files
author
Jo-Philipp Wich
<jow@openwrt.org>
Thu, 25 Jul 2013 14:17:52 +0000
(16:17 +0200)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Thu, 25 Jul 2013 14:17:52 +0000
(16:17 +0200)
block.c
patch
|
blob
|
history
diff --git
a/block.c
b/block.c
index
5ae0fd0
..
b5bc494
100644
(file)
--- a/
block.c
+++ b/
block.c
@@
-910,8
+910,8
@@
static int main_swapon(int argc, char **argv)
struct stat s;
int err;
struct stat s;
int err;
- if (stat(argv[1], &s) ||
!S_ISBLK(s.st_mode
)) {
- fprintf(stderr, "%s is not a block device\n", argv[1]);
+ if (stat(argv[1], &s) ||
(!S_ISBLK(s.st_mode) && !S_ISREG(s.st_mode)
)) {
+ fprintf(stderr, "%s is not a block device
or file
\n", argv[1]);
return -1;
}
err = swapon(argv[1], 0);
return -1;
}
err = swapon(argv[1], 0);
@@
-956,8
+956,8
@@
static int main_swapoff(int argc, char **argv)
struct stat s;
int err;
struct stat s;
int err;
- if (stat(argv[1], &s) ||
!S_ISBLK(s.st_mode
)) {
- fprintf(stderr, "%s is not a block device\n", argv[1]);
+ if (stat(argv[1], &s) ||
(!S_ISBLK(s.st_mode) && !S_ISREG(s.st_mode)
)) {
+ fprintf(stderr, "%s is not a block device
or file
\n", argv[1]);
return -1;
}
err = swapoff(argv[1]);
return -1;
}
err = swapoff(argv[1]);