Changeset 1770 in MondoRescue for branches/stable/mindi-busybox/util-linux/swaponoff.c
- Timestamp:
- Nov 6, 2007, 11:01:53 AM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stable/mindi-busybox/util-linux/swaponoff.c
r821 r1770 5 5 * Copyright (C) 1999-2004 by Erik Andersen <andersen@codepoet.org> 6 6 * 7 * Licensed under the GPL v 2, see the file LICENSE in this tarball.7 * Licensed under the GPL version 2, see the file LICENSE in this tarball. 8 8 */ 9 9 10 #include " busybox.h"10 #include "libbb.h" 11 11 #include <mntent.h> 12 #include <dirent.h>13 #include <errno.h>14 #include <string.h>15 12 #include <sys/swap.h> 16 13 17 18 static int swap_enable_disable(const char *device) 14 static int swap_enable_disable(char *device) 19 15 { 20 16 int status; … … 23 19 xstat(device, &st); 24 20 21 #if ENABLE_DESKTOP 25 22 /* test for holes */ 26 23 if (S_ISREG(st.st_mode)) 27 24 if (st.st_blocks * 512 < st.st_size) 28 bb_error_msg_and_die("swap file has holes"); 25 bb_error_msg("warning: swap file has holes"); 26 #endif 29 27 30 if ( bb_applet_name[5] == 'n')28 if (applet_name[5] == 'n') 31 29 status = swapon(device, 0); 32 30 else … … 61 59 } 62 60 63 #define DO_ALL 0x01 64 61 int swap_on_off_main(int argc, char **argv); 65 62 int swap_on_off_main(int argc, char **argv) 66 63 { … … 70 67 bb_show_usage(); 71 68 72 ret = bb_getopt_ulflags(argc,argv, "a");73 if (ret & DO_ALL)69 ret = getopt32(argv, "a"); 70 if (ret) 74 71 return do_em_all(); 75 72 76 ret = 0;73 /* ret = 0; redundant */ 77 74 while (*++argv) 78 75 ret += swap_enable_disable(*argv);
Note:
See TracChangeset
for help on using the changeset viewer.