From c07ebfa1e02d208ab12430e6791ea147bcfaf9c0 Mon Sep 17 00:00:00 2001 From: Karel Zak Date: Thu, 7 Dec 2006 00:25:46 +0100 Subject: Imported from util-linux-2.11b tarball. --- mount/lomount.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'mount/lomount.c') diff --git a/mount/lomount.c b/mount/lomount.c index cabc44461..26e895018 100644 --- a/mount/lomount.c +++ b/mount/lomount.c @@ -2,7 +2,7 @@ /* Added vfs mount options - aeb - 960223 */ /* Removed lomount - aeb - 960224 */ -/* 1999-02-22 Arkadiusz Mi¶kiewicz +/* 1999-02-22 Arkadiusz Mi¶kiewicz * - added Native Language Support * Sun Mar 21 1999 - Arnaldo Carvalho de Melo * - fixed strerr(errno) in gettext calls @@ -27,6 +27,7 @@ #include "loop.h" #include "lomount.h" +#include "xstrncpy.h" #include "nls.h" extern int verbose; @@ -217,8 +218,7 @@ set_loop (const char *device, const char *file, int offset, *loopro = (mode == O_RDONLY); memset (&loopinfo, 0, sizeof (loopinfo)); - strncpy (loopinfo.lo_name, file, LO_NAME_SIZE); - loopinfo.lo_name[LO_NAME_SIZE - 1] = 0; + xstrncpy (loopinfo.lo_name, file, LO_NAME_SIZE); if (encryption && (loopinfo.lo_encrypt_type = crypt_type (encryption)) < 0) { fprintf (stderr, _("Unsupported encryption type %s\n"), @@ -233,7 +233,7 @@ set_loop (const char *device, const char *file, int offset, * passwd etc being swapped out and left somewhere on disk. */ - if(mlockall(MCL_CURRENT|MCL_FUTURE)) { + if(mlockall(MCL_CURRENT | MCL_FUTURE)) { perror("memlock"); fprintf(stderr, _("Couldn't lock into memory, exiting.\n")); exit(1); @@ -246,8 +246,7 @@ set_loop (const char *device, const char *file, int offset, break; case LO_CRYPT_XOR: pass = getpass (_("Password: ")); - strncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE); - loopinfo.lo_encrypt_key[LO_KEY_SIZE - 1] = 0; + xstrncpy (loopinfo.lo_encrypt_key, pass, LO_KEY_SIZE); loopinfo.lo_encrypt_key_size = strlen(loopinfo.lo_encrypt_key); break; case LO_CRYPT_DES: -- cgit v1.2.3-55-g7522