Whamcloud - gitweb
debian/changelog: add missing section for 1.46.2-2
[tools/e2fsprogs.git] / misc / e2label.c
index cf65513..910ccc7 100644 (file)
@@ -2,7 +2,7 @@
  * e2label.c           - Print or change the volume label on an ext2 fs
  *
  * Written by Andries Brouwer (aeb@cwi.nl), 970714
- * 
+ *
  * Copyright 1997, 1998 by Theodore Ts'o.
  *
  * %Begin-Header%
@@ -11,6 +11,7 @@
  * %End-Header%
  */
 
+#include "config.h"
 #include <stdio.h>
 #include <string.h>
 #include <fcntl.h>
@@ -32,7 +33,7 @@ extern int optind;
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
-#include "nls-enable.h"
+#include "support/nls-enable.h"
 
 #define EXT2_SUPER_MAGIC 0xEF53
 
@@ -80,7 +81,7 @@ static void print_label (char *dev)
        char label[VOLNAMSZ+1];
 
        open_e2fs (dev, O_RDONLY);
-       strncpy(label, sb.s_volume_name, VOLNAMSZ);
+       snprintf(label, sizeof(label), "%.*s", EXT2_LEN_STR(sb.s_volume_name));
        label[VOLNAMSZ] = 0;
        printf("%s\n", label);
 }