summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChuck Lever <chuck.lever@oracle.com>2012-10-30 14:06:22 -0400
committerSteve Dickson <steved@redhat.com>2012-10-30 15:30:08 -0400
commit15b940351e88da5cb3d68d71887196f89a13e0de (patch)
tree3a2765cf409808ea9ad31a2930663ba8374aaa2d
parenta543ffd62ceade54ad0663765ae2909b6be361f9 (diff)
downloadnfs-utils-15b940351e88da5cb3d68d71887196f89a13e0de.tar.gz
nfs-utils-15b940351e88da5cb3d68d71887196f89a13e0de.tar.xz
nfs-utils-15b940351e88da5cb3d68d71887196f89a13e0de.zip
mountd: Make local functions static
Removed a couple Wmissing-prototypes warnings in the mountd code. Once the parse_fsid() function was made static, the compiler detected execution paths through it that did not initialize some fields in *parsed. [ I'm pretty sure these problems are currently harmless, since each path is taken depending on the value of the .fsidtype field. Each path accesses only the fields in *parsed that it cares about. ] This is because parsed_fsid isn't a union type. parse_fsid() leaves uninitialized fields that are not used by a particular fsidtype. To prevent an accidental dereference of stack garbage (.fhuuid being an example of a pointer that is left uninitialized sometimes), have parse_fsid() defensively pre-initialize *parsed to zero. Signed-off-by: Chuck Lever <chuck.lever@oracle.com> Signed-off-by: Steve Dickson <steved@redhat.com>
-rw-r--r--utils/mountd/cache.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/utils/mountd/cache.c b/utils/mountd/cache.c
index 70e1aa4..57a3fed 100644
--- a/utils/mountd/cache.c
+++ b/utils/mountd/cache.c
@@ -370,11 +370,13 @@ struct parsed_fsid {
char *fhuuid;
};
-int parse_fsid(int fsidtype, int fsidlen, char *fsid, struct parsed_fsid *parsed)
+static int parse_fsid(int fsidtype, int fsidlen, char *fsid,
+ struct parsed_fsid *parsed)
{
unsigned int dev;
unsigned long long inode64;
+ memset(parsed, 0, sizeof(*parsed));
parsed->fsidtype = fsidtype;
switch(fsidtype) {
case FSID_DEV: /* 4 bytes: 2 major, 2 minor, 4 inode */
@@ -501,7 +503,7 @@ static bool match_fsid(struct parsed_fsid *parsed, nfs_export *exp, char *path)
return false;
}
-struct addrinfo *lookup_client_addr(char *dom)
+static struct addrinfo *lookup_client_addr(char *dom)
{
struct addrinfo *ret;
struct addrinfo *tmp;