aboutsummaryrefslogtreecommitdiffstats
path: root/mount.cifs.c
diff options
context:
space:
mode:
authorJeff Layton <jlayton@samba.org>2012-04-19 07:29:46 -0400
committerJeff Layton <jlayton@samba.org>2012-04-19 07:29:46 -0400
commit8c6268cbbd4202631e5c4b30297adc0088a1d568 (patch)
tree45497821b3e260d6161f3fc7a88743b156cf8bbf /mount.cifs.c
parent676f0386df51b36df42d8b6b815b7d9d8b6934dc (diff)
downloadcifs-utils-8c6268cbbd4202631e5c4b30297adc0088a1d568.tar.gz
cifs-utils-8c6268cbbd4202631e5c4b30297adc0088a1d568.tar.xz
cifs-utils-8c6268cbbd4202631e5c4b30297adc0088a1d568.zip
mount.cifs: fix up some -D_FORTIFY_SOURCE=2 warnings
...and add -D_FORTIFY_SOURCE=2 to the default $CFLAGS. Acked-by: Acked-by: Suresh Jayaraman <sjayaraman@suse.com> Signed-off-by: Jeff Layton <jlayton@samba.org>
Diffstat (limited to 'mount.cifs.c')
-rw-r--r--mount.cifs.c14
1 files changed, 8 insertions, 6 deletions
diff --git a/mount.cifs.c b/mount.cifs.c
index f0b073e..2c481d8 100644
--- a/mount.cifs.c
+++ b/mount.cifs.c
@@ -927,11 +927,11 @@ parse_options(const char *data, struct parsed_mount_info *parsed_info)
return EX_USAGE;
}
} else {
- /* domain/username%password */
- const int max = MAX_DOMAIN_SIZE +
- MAX_USERNAME_SIZE +
- MOUNT_PASSWD_SIZE + 2;
- if (strnlen(value, max + 1) >= max + 1) {
+ /* domain/username%password + NULL term. */
+ const size_t max = MAX_DOMAIN_SIZE +
+ MAX_USERNAME_SIZE +
+ MOUNT_PASSWD_SIZE + 2 + 1;
+ if (strnlen(value, max) >= max) {
fprintf(stderr, "username too long\n");
return EX_USAGE;
}
@@ -1603,8 +1603,10 @@ add_mtab(char *devname, char *mountpoint, unsigned long flags, const char *fstyp
mountent.mnt_passno = 0;
rc = addmntent(pmntfile, &mountent);
if (rc) {
+ int ignore __attribute__((unused));
+
fprintf(stderr, "unable to add mount entry to mtab\n");
- ftruncate(fd, statbuf.st_size);
+ ignore = ftruncate(fd, statbuf.st_size);
rc = EX_FILEIO;
}
tmprc = my_endmntent(pmntfile, statbuf.st_size);