wok-6.x diff busybox/stuff/busybox-1.12.0-mkswap.u @ rev 3427
ruby,xchm,xine-ui,xrick: Remove dep on libiconv
author | Christophe Lincoln <pankso@slitaz.org> |
---|---|
date | Sat Jun 13 13:13:25 2009 +0200 (2009-06-13) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/busybox/stuff/busybox-1.12.0-mkswap.u Sat Jun 13 13:13:25 2009 +0200 1.3 @@ -0,0 +1,35 @@ 1.4 +Without label, Gparted call mkswap -L '' <device> 1.5 +--- busybox-1.12.0/util-linux/mkswap.c 1.6 ++++ busybox-1.12.0/util-linux/mkswap.c 1.7 +@@ -92,14 +92,14 @@ 1.8 + { 1.9 + int fd, pagesize; 1.10 + off_t len; 1.11 ++ char *label = NULL; 1.12 + 1.13 +- // No options supported. 1.14 +- 1.15 +- if (argc != 2) bb_show_usage(); 1.16 ++ getopt32(argv, "L:", &label); 1.17 ++ argv += optind; 1.18 + 1.19 + // Figure out how big the device is and announce our intentions. 1.20 + 1.21 +- fd = xopen(argv[1], O_RDWR); 1.22 ++ fd = xopen(argv[0], O_RDWR); 1.23 + /* fdlength was reported to be unreliable - use seek */ 1.24 + len = xlseek(fd, 0, SEEK_END); 1.25 + #if ENABLE_SELINUX 1.26 +@@ -119,6 +119,12 @@ 1.27 + 1.28 + xlseek(fd, 1024, SEEK_SET); 1.29 + xwrite(fd, hdr, NWORDS * 4); 1.30 ++ if (label) { 1.31 ++ if (strlen(label) > 15) 1.32 ++ label[15] = 0; 1.33 ++ xlseek(fd, 1024 + 28, SEEK_SET); 1.34 ++ xwrite(fd, label, strlen(label)); 1.35 ++ } 1.36 + xlseek(fd, pagesize - 10, SEEK_SET); 1.37 + xwrite(fd, SWAPSPACE2, 10); 1.38 + fsync(fd);