aboutsummaryrefslogtreecommitdiff
path: root/util-linux
diff options
context:
space:
mode:
Diffstat (limited to 'util-linux')
-rw-r--r--util-linux/hexdump.c2
-rw-r--r--util-linux/mkfs_vfat.c25
-rw-r--r--util-linux/nsenter.c2
-rw-r--r--util-linux/unshare.c2
4 files changed, 20 insertions, 11 deletions
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index 57e7e8db7..307a84803 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -71,7 +71,7 @@ static void bb_dump_addfile(dumper_t *dumper, char *name)
71 fclose(fp); 71 fclose(fp);
72} 72}
73 73
74static const char *const add_strings[] = { 74static const char *const add_strings[] ALIGN_PTR = {
75 "\"%07.7_ax \"16/1 \"%03o \"\"\n\"", /* b */ 75 "\"%07.7_ax \"16/1 \"%03o \"\"\n\"", /* b */
76 "\"%07.7_ax \"16/1 \"%3_c \"\"\n\"", /* c */ 76 "\"%07.7_ax \"16/1 \"%3_c \"\"\n\"", /* c */
77 "\"%07.7_ax \"8/2 \" %05u \"\"\n\"", /* d */ 77 "\"%07.7_ax \"8/2 \" %05u \"\"\n\"", /* d */
diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c
index 844d965f8..821371953 100644
--- a/util-linux/mkfs_vfat.c
+++ b/util-linux/mkfs_vfat.c
@@ -218,8 +218,11 @@ static const char boot_code[] ALIGN1 =
218int mkfs_vfat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 218int mkfs_vfat_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
219int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv) 219int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
220{ 220{
221 static const char NO_NAME_11[] = "NO NAME ";
222
221 struct stat st; 223 struct stat st;
222 const char *volume_label = ""; 224 const char *arg_volume_label = NO_NAME_11; //default
225 char volume_label11[12];
223 char *buf; 226 char *buf;
224 char *device_name; 227 char *device_name;
225 uoff_t volume_size_bytes; 228 uoff_t volume_size_bytes;
@@ -257,14 +260,17 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
257 opts = getopt32(argv, "^" 260 opts = getopt32(argv, "^"
258 "Ab:cCf:F:h:Ii:l:m:n:r:R:s:S:v" 261 "Ab:cCf:F:h:Ii:l:m:n:r:R:s:S:v"
259 "\0" "-1", //:b+:f+:F+:h+:r+:R+:s+:S+:vv:c--l:l--c 262 "\0" "-1", //:b+:f+:F+:h+:r+:R+:s+:S+:vv:c--l:l--c
260 NULL, NULL, NULL, NULL, NULL, 263 /*b*/NULL, /*f*/NULL, /*F*/NULL, /*h*/NULL, /*i*/NULL,
261 NULL, NULL, &volume_label, NULL, NULL, NULL, NULL); 264 /*l*/NULL, /*m*/NULL, /*n*/&arg_volume_label,
265 /*r*/NULL, /*R*/NULL, /*s*/NULL, /*S*/NULL);
262 argv += optind; 266 argv += optind;
263 267
264 // cache device name 268 // cache device name
265 device_name = argv[0]; 269 device_name = argv[0];
266 // default volume ID = creation time 270 // default volume ID = creation time
267 volume_id = time(NULL); 271 volume_id = time(NULL);
272 // truncate to exactly 11 chars, pad with spaces
273 sprintf(volume_label11, "%-11.11s", arg_volume_label);
268 274
269 dev = xopen(device_name, O_RDWR); 275 dev = xopen(device_name, O_RDWR);
270 xfstat(dev, &st, device_name); 276 xfstat(dev, &st, device_name);
@@ -459,7 +465,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
459 (int)media_byte, 465 (int)media_byte,
460 volume_size_sect, (int)total_clust, (int)sect_per_clust, 466 volume_size_sect, (int)total_clust, (int)sect_per_clust,
461 sect_per_fat, 467 sect_per_fat,
462 (int)volume_id, volume_label 468 (int)volume_id, volume_label11
463 ); 469 );
464 } 470 }
465 471
@@ -508,7 +514,7 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
508 STORE_LE(boot_blk->vi.ext_boot_sign, 0x29); 514 STORE_LE(boot_blk->vi.ext_boot_sign, 0x29);
509 STORE_LE(boot_blk->vi.volume_id32, volume_id); 515 STORE_LE(boot_blk->vi.volume_id32, volume_id);
510 memcpy(boot_blk->vi.fs_type, "FAT32 ", sizeof(boot_blk->vi.fs_type)); 516 memcpy(boot_blk->vi.fs_type, "FAT32 ", sizeof(boot_blk->vi.fs_type));
511 strncpy(boot_blk->vi.volume_label, volume_label, sizeof(boot_blk->vi.volume_label)); 517 memcpy(boot_blk->vi.volume_label, volume_label11, 11);
512 memcpy(boot_blk->boot_code, boot_code, sizeof(boot_code)); 518 memcpy(boot_blk->boot_code, boot_code, sizeof(boot_code));
513 STORE_LE(boot_blk->boot_sign, BOOT_SIGN); 519 STORE_LE(boot_blk->boot_sign, BOOT_SIGN);
514 520
@@ -545,15 +551,18 @@ int mkfs_vfat_main(int argc UNUSED_PARAM, char **argv)
545 // root directory 551 // root directory
546 // empty directory is just a set of zero bytes 552 // empty directory is just a set of zero bytes
547 memset(buf, 0, sect_per_clust * bytes_per_sect); 553 memset(buf, 0, sect_per_clust * bytes_per_sect);
548 if (volume_label[0]) { 554 // not "NO NAME", "NO NAME " etc?
549 // create dir entry for volume_label 555 // (mkfs.fat 4.1 won't create dir entry even with explicit -n 'NO NAME',
556 // but will create one with e.g. -n '', -n ' zZz')
557 if (strcmp(volume_label11, NO_NAME_11) != 0) {
558 // create dir entry for volume label
550 struct msdos_dir_entry *de; 559 struct msdos_dir_entry *de;
551#if 0 560#if 0
552 struct tm tm_time; 561 struct tm tm_time;
553 uint16_t t, d; 562 uint16_t t, d;
554#endif 563#endif
555 de = (void*)buf; 564 de = (void*)buf;
556 strncpy(de->name, volume_label, sizeof(de->name)); 565 memcpy(de->name, volume_label11, 11);
557 STORE_LE(de->attr, ATTR_VOLUME); 566 STORE_LE(de->attr, ATTR_VOLUME);
558#if 0 567#if 0
559 localtime_r(&create_time, &tm_time); 568 localtime_r(&create_time, &tm_time);
diff --git a/util-linux/nsenter.c b/util-linux/nsenter.c
index e6339da2f..1aa045b35 100644
--- a/util-linux/nsenter.c
+++ b/util-linux/nsenter.c
@@ -93,7 +93,7 @@ enum {
93 * The user namespace comes first, so that it is entered first. 93 * The user namespace comes first, so that it is entered first.
94 * This gives an unprivileged user the potential to enter other namespaces. 94 * This gives an unprivileged user the potential to enter other namespaces.
95 */ 95 */
96static const struct namespace_descr ns_list[] = { 96static const struct namespace_descr ns_list[] ALIGN_INT = {
97 { CLONE_NEWUSER, "ns/user", }, 97 { CLONE_NEWUSER, "ns/user", },
98 { CLONE_NEWIPC, "ns/ipc", }, 98 { CLONE_NEWIPC, "ns/ipc", },
99 { CLONE_NEWUTS, "ns/uts", }, 99 { CLONE_NEWUTS, "ns/uts", },
diff --git a/util-linux/unshare.c b/util-linux/unshare.c
index 68ccdd874..06b938074 100644
--- a/util-linux/unshare.c
+++ b/util-linux/unshare.c
@@ -120,7 +120,7 @@ enum {
120 NS_USR_POS, /* OPT_user, NS_USR_POS, and ns_list[] index must match! */ 120 NS_USR_POS, /* OPT_user, NS_USR_POS, and ns_list[] index must match! */
121 NS_COUNT, 121 NS_COUNT,
122}; 122};
123static const struct namespace_descr ns_list[] = { 123static const struct namespace_descr ns_list[] ALIGN_INT = {
124 { CLONE_NEWNS, "mnt" }, 124 { CLONE_NEWNS, "mnt" },
125 { CLONE_NEWUTS, "uts" }, 125 { CLONE_NEWUTS, "uts" },
126 { CLONE_NEWIPC, "ipc" }, 126 { CLONE_NEWIPC, "ipc" },