Enforce stricter warnings. - susmb - mounting of SMB/CIFS shares via FUSE | |
git clone git://git.codemadness.org/susmb | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
commit fdd9015111ff8fcb39d85d25250d14b1d532e44f | |
parent 0f068c22353a61db22df334ef605f19ef213cd49 | |
Author: Geoff Johnstone <[email protected]> | |
Date: Fri, 12 Feb 2010 23:37:03 +0000 | |
Enforce stricter warnings. | |
Diffstat: | |
M Makefile.in | 4 ++-- | |
M conffile.c | 3 ++- | |
M configure.ac | 18 +++++++++--------- | |
M options.c | 23 +++++++++++++++-------- | |
M usmb.c | 20 ++++++++++---------- | |
M usmb_dir.c | 16 ++++++++-------- | |
M version.c | 2 +- | |
M version.h | 2 +- | |
M xml.c | 6 +++--- | |
9 files changed, 51 insertions(+), 43 deletions(-) | |
--- | |
diff --git a/Makefile.in b/Makefile.in | |
@@ -2,7 +2,7 @@ | |
# | |
# @configure_input@ | |
# | |
-# Copyright (C) 2006-2009 Geoff Johnstone | |
+# Copyright (C) 2006-2010 Geoff Johnstone | |
# | |
# This program is free software; you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License version 3 as | |
@@ -22,7 +22,7 @@ prefix = @prefix@ | |
exec_prefix = @exec_prefix@ | |
bindir = @bindir@ | |
-CFLAGS = @CFLAGS@ -I@srcdir@ -I@builddir@ | |
+CFLAGS = @CFLAGS@ -I@srcdir@ -I@builddir@ -Werror | |
LDFLAGS = @LDFLAGS@ | |
LIBS = @LIBS@ | |
diff --git a/conffile.c b/conffile.c | |
@@ -1,5 +1,5 @@ | |
/* usmb - mount SMB shares via FUSE and Samba | |
- * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * Copyright (C) 2006-2010 Geoff Johnstone | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License version 3 as | |
@@ -26,6 +26,7 @@ | |
#include <unistd.h> | |
#include "utils.h" | |
#include "xml.h" | |
+#include "conffile.h" | |
#include "config.rng.h" | |
diff --git a/configure.ac b/configure.ac | |
@@ -1,5 +1,5 @@ | |
AC_PREREQ([2.63]) | |
-AC_INIT([usmb], [20090411]) | |
+AC_INIT([usmb], [20100212]) | |
AC_CONFIG_SRCDIR([usmb.c]) | |
AC_CONFIG_HEADERS([config.h]) | |
@@ -33,7 +33,7 @@ m4_define([MUSTCHECK_],[]) | |
if test "$GCC" = yes ; then | |
m4_define([UNUSED_], [__attribute__ ((unused))]) | |
m4_define([MUSTCHECK_], [__attribute__ ((warn_unused_result))]) | |
- CFLAGS="$CFLAGS -Wall -Wextra -Werror -pedantic" | |
+ CFLAGS="$CFLAGS -Wall -Wextra -pedantic -Wformat-security -Winit-self -Wwrit… | |
fi | |
AC_DEFINE([UNUSED], [UNUSED_], [Marks unused parameters]) | |
@@ -46,18 +46,18 @@ AC_CHECK_LIB([smbclient], [smbc_init], [], | |
AC_CHECK_LIB([smbclient], [smbc_getFunctionStatVFS], | |
[AC_DEFINE([HAVE_SAMBA33], [], | |
- [Whether we have Samba 3.3 o… | |
- SAMBA_VERSION=33]) | |
+ [Whether we have Samba 3.3 or later]) | |
+ SAMBA_VERSION=33]) | |
AC_CHECK_LIB([smbclient], [smbc_getFunctionOpen], | |
[AC_DEFINE([HAVE_SAMBA32], [], | |
- [Whether we have Samba 3.2 o… | |
- if test "$SAMBA_VERSION" = "… | |
- SAMBA_VERSION=… | |
- fi]) | |
+ [Whether we have Samba 3.2 or later]) | |
+ if test "$SAMBA_VERSION" = "" ; then | |
+ SAMBA_VERSION=32 | |
+ fi]) | |
if test "$SAMBA_VERSION" = '' ; then | |
- SAMBA_VERSION=30 | |
+ SAMBA_VERSION=30 | |
fi | |
AC_SUBST(SAMBA_VERSION,[$SAMBA_VERSION]) | |
diff --git a/options.c b/options.c | |
@@ -1,5 +1,5 @@ | |
/* usmb - mount SMB shares via FUSE and Samba | |
- * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * Copyright (C) 2006-2010 Geoff Johnstone | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License version 3 as | |
@@ -144,29 +144,36 @@ bool parse_args (int *argc, char ***argv, | |
void build_fuse_args (const char *options, const char *mountpoint, | |
int *out_argc, char ***out_argv) | |
{ | |
+ static char USMB[] = "usmb"; | |
+ static char MINUS_S[] = "-s"; | |
+ static char MINUS_D[] = "-d"; | |
+ static char MINUS_F[] = "-f"; | |
+ static char MINUS_O[] = "-o"; | |
+ static char MAX_READ[] = "max_read=32768"; | |
+ | |
assert (NULL != mountpoint); | |
static char *argv[MAXARGS]; | |
int argc = 0; | |
- argv[argc++] = "usmb"; | |
- argv[argc++] = "-s"; | |
+ argv[argc++] = USMB; | |
+ argv[argc++] = MINUS_S; | |
if (debug) | |
- argv[argc++] = "-d"; | |
+ argv[argc++] = MINUS_D; | |
// force -f in debug mode | |
#ifndef DEBUGON | |
if (nofork) | |
#endif | |
- argv[argc++] = "-f"; | |
+ argv[argc++] = MINUS_F; | |
- argv[argc++] = "-o"; | |
- argv[argc++] = "max_read=32768"; | |
+ argv[argc++] = MINUS_O; | |
+ argv[argc++] = MAX_READ; | |
if ((NULL != options) && ('\0' != options[0])) | |
{ | |
- argv[argc++] = "-o"; | |
+ argv[argc++] = MINUS_O; | |
argv[argc++] = (char *)options; | |
} | |
diff --git a/usmb.c b/usmb.c | |
@@ -1,5 +1,5 @@ | |
/* usmb - mount SMB shares via FUSE and Samba | |
- * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * Copyright (C) 2006-2010 Geoff Johnstone | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License version 3 as | |
@@ -77,12 +77,12 @@ static void auth_fn (const char *srv UNUSED, const char *sh… | |
} | |
-void destroy_smb_context (SMBCCTX *ctx, int shutdown) | |
+void destroy_smb_context (SMBCCTX *ctx_, int shutdown) | |
{ | |
// Samba frees the workgroup and user strings but we want to persist them. | |
- smbc_setWorkgroup (ctx, NULL); | |
- smbc_setUser (ctx, NULL); | |
- smbc_free_context (ctx, shutdown); | |
+ smbc_setWorkgroup (ctx_, NULL); | |
+ smbc_setUser (ctx_, NULL); | |
+ smbc_free_context (ctx_, shutdown); | |
} | |
@@ -178,10 +178,10 @@ static struct fuse_operations fuse_ops = { | |
}; | |
-static bool create_share_name (const char *server, const char *sharename) | |
+static bool create_share_name (const char *server_, const char *sharename) | |
{ | |
size_t len = strlen ("smb:///") + | |
- strlen (server) + | |
+ strlen (server_) + | |
strlen (sharename) + 1; | |
if (NULL == (share = malloc (len))) | |
@@ -190,7 +190,7 @@ static bool create_share_name (const char *server, const ch… | |
return false; | |
} | |
- snprintf (share, len, "smb://%s/%s", server, sharename); | |
+ snprintf (share, len, "smb://%s/%s", server_, sharename); | |
DEBUG (fprintf (stderr, "Share URL: %s\n", share)); | |
return true; | |
} | |
@@ -220,8 +220,8 @@ static bool check_credentials (void) | |
DEBUG (fprintf (stderr, "URL: %s\n", url)); | |
- struct stat stat; | |
- bool ret = (0 == (smbc_getFunctionStat (ctx) (ctx, url, &stat))); | |
+ struct stat stat_; | |
+ bool ret = (0 == (smbc_getFunctionStat (ctx) (ctx, url, &stat_))); | |
free_errno (url); | |
return ret; | |
diff --git a/usmb_dir.c b/usmb_dir.c | |
@@ -1,5 +1,5 @@ | |
/* usmb - mount SMB shares via FUSE and Samba | |
- * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * Copyright (C) 2006-2010 Geoff Johnstone | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License version 3 as | |
@@ -79,7 +79,7 @@ int usmb_opendir (const char *dirname, struct fuse_file_info … | |
int usmb_readdir (const char *path, void *h, fuse_fill_dir_t filler, | |
off_t offset UNUSED, struct fuse_file_info *fi UNUSED) | |
{ | |
- SMBCCTX *ctx = NULL; | |
+ SMBCCTX *ctx_ = NULL; | |
SMBCFILE *file = NULL; | |
char *url = NULL; | |
struct smbc_dirent *dirent; | |
@@ -87,7 +87,7 @@ int usmb_readdir (const char *path, void *h, fuse_fill_dir_t … | |
DEBUG (fprintf (stderr, "readdir (%s)\n", path)); | |
- if (!create_smb_context (&ctx)) | |
+ if (!create_smb_context (&ctx_)) | |
return -errno; | |
do | |
@@ -99,16 +99,16 @@ int usmb_readdir (const char *path, void *h, fuse_fill_dir_… | |
break; | |
} | |
- file = smbc_getFunctionOpendir (ctx) (ctx, url); | |
+ file = smbc_getFunctionOpendir (ctx_) (ctx_, url); | |
if (NULL == file) | |
{ | |
ret = -errno; | |
break; | |
} | |
- smbc_getFunctionLseekdir (ctx) (ctx, file, 0); | |
+ smbc_getFunctionLseekdir (ctx_) (ctx_, file, 0); | |
- while (NULL != (dirent = smbc_getFunctionReaddir (ctx) (ctx, file))) | |
+ while (NULL != (dirent = smbc_getFunctionReaddir (ctx_) (ctx_, file))) | |
{ | |
struct stat stbuf; | |
@@ -140,12 +140,12 @@ int usmb_readdir (const char *path, void *h, fuse_fill_di… | |
} while (false /*CONSTCOND*/); | |
if (NULL != file) | |
- (void)smbc_getFunctionClosedir (ctx) (ctx, file); | |
+ (void)smbc_getFunctionClosedir (ctx_) (ctx_, file); | |
if (NULL != url) | |
free (url); | |
- destroy_smb_context (ctx, 0); | |
+ destroy_smb_context (ctx_, 0); | |
return ret; | |
} | |
diff --git a/version.c b/version.c | |
@@ -34,7 +34,7 @@ void show_about (FILE *fp) | |
{ | |
fprintf (fp, "usmb - mount SMB shares via FUSE and Samba\n" | |
"\n" | |
- "Copyright (C) 2006-2009 Geoff Johnstone.\n" | |
+ "Copyright (C) 2006-2010 Geoff Johnstone.\n" | |
"Licensed under the GNU General Public License.\n" | |
"usmb comes with ABSOLUTELY NO WARRANTY; " | |
"for details please see\n" | |
diff --git a/version.h b/version.h | |
@@ -19,7 +19,7 @@ | |
#include <stdio.h> | |
- #define USMB_VERSION 0x20090411 | |
+ #define USMB_VERSION 0x20100212 | |
// a - alpha, b - beta, p - pre-release, s - stable | |
#define USMB_VERSION_STATUS 'b' | |
diff --git a/xml.c b/xml.c | |
@@ -1,5 +1,5 @@ | |
/* usmb - mount SMB shares via FUSE and Samba | |
- * Copyright (C) 2006-2009 Geoff Johnstone | |
+ * Copyright (C) 2006-2010 Geoff Johnstone | |
* | |
* This program is free software; you can redistribute it and/or modify | |
* it under the terms of the GNU General Public License version 3 as | |
@@ -66,7 +66,7 @@ bool xml_validate_relaxng (xmlDocPtr doc, const char *schema) | |
bool xml_xpath_attr_value (xmlXPathContextPtr ctx, | |
char *xpath, | |
- const char *attribute, | |
+ const char *attr, | |
char **out) | |
{ | |
xmlXPathObjectPtr obj; | |
@@ -106,7 +106,7 @@ bool xml_xpath_attr_value (xmlXPathContextPtr ctx, | |
break; | |
} | |
- tmp = xmlGetProp (obj->nodesetval->nodeTab[0], BAD_CAST attribute); | |
+ tmp = xmlGetProp (obj->nodesetval->nodeTab[0], BAD_CAST attr); | |
if (NULL == tmp) | |
break; | |