MFV r277870
Fix compile warnings for gcc-4.4.x This also fixes at least a warning with clang 3.6.0 including the fix for r277841. MFC after: 1 week
This commit is contained in:
commit
71501ba6e3
@ -147,10 +147,12 @@ amfs_program_exec(char *info)
|
|||||||
(void) fclose(stdout);
|
(void) fclose(stdout);
|
||||||
if (!logfp)
|
if (!logfp)
|
||||||
logfp = stderr; /* initialize before possible first use */
|
logfp = stderr; /* initialize before possible first use */
|
||||||
(void) dup(fileno(logfp));
|
if (dup(fileno(logfp)) == -1)
|
||||||
|
return errno;
|
||||||
if (fileno(logfp) != fileno(stderr)) {
|
if (fileno(logfp) != fileno(stderr)) {
|
||||||
(void) fclose(stderr);
|
(void) fclose(stderr);
|
||||||
(void) dup(fileno(logfp));
|
if (dup(fileno(logfp)) == -1)
|
||||||
|
return errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -63,6 +63,7 @@ static int key_already_in_chain(char *keyname, const nfsentry *chain);
|
|||||||
static nfsentry *make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable);
|
static nfsentry *make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable);
|
||||||
static int amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable);
|
static int amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep, u_int count, int fully_browsable);
|
||||||
|
|
||||||
|
static const u_int dotdotcookie = DOT_DOT_COOKIE;
|
||||||
|
|
||||||
/****************************************************************************
|
/****************************************************************************
|
||||||
*** FUNCTIONS ***
|
*** FUNCTIONS ***
|
||||||
@ -178,8 +179,9 @@ make_entry_chain(am_node *mp, const nfsentry *current_chain, int fully_browsable
|
|||||||
|
|
||||||
/* we have space. put entry in next cell */
|
/* we have space. put entry in next cell */
|
||||||
++last_cookie;
|
++last_cookie;
|
||||||
chain[num_entries].ne_fileid = (u_int) last_cookie;
|
chain[num_entries].ne_fileid = last_cookie;
|
||||||
*(u_int *) chain[num_entries].ne_cookie = (u_int) last_cookie;
|
(void)memcpy(chain[num_entries].ne_cookie, &last_cookie,
|
||||||
|
sizeof(last_cookie));
|
||||||
chain[num_entries].ne_name = key;
|
chain[num_entries].ne_name = key;
|
||||||
if (num_entries < max_entries - 1) { /* link to next one */
|
if (num_entries < max_entries - 1) { /* link to next one */
|
||||||
chain[num_entries].ne_nextentry = &chain[num_entries + 1];
|
chain[num_entries].ne_nextentry = &chain[num_entries + 1];
|
||||||
@ -253,7 +255,7 @@ amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *
|
|||||||
ep[0].ne_fileid = mp->am_gen;
|
ep[0].ne_fileid = mp->am_gen;
|
||||||
ep[0].ne_name = ".";
|
ep[0].ne_name = ".";
|
||||||
ep[0].ne_nextentry = &ep[1];
|
ep[0].ne_nextentry = &ep[1];
|
||||||
*(u_int *) ep[0].ne_cookie = 0;
|
(void)memset(ep[0].ne_cookie, 0, sizeof(u_int));
|
||||||
|
|
||||||
/* construct ".." */
|
/* construct ".." */
|
||||||
if (mp->am_parent)
|
if (mp->am_parent)
|
||||||
@ -300,9 +302,12 @@ amfs_readdir_browsable(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *
|
|||||||
nfsentry *ne;
|
nfsentry *ne;
|
||||||
for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
|
for (j = 0, ne = te; ne; ne = ne->ne_nextentry)
|
||||||
plog(XLOG_DEBUG, "gen2 key %4d \"%s\"", j++, ne->ne_name);
|
plog(XLOG_DEBUG, "gen2 key %4d \"%s\"", j++, ne->ne_name);
|
||||||
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
|
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry) {
|
||||||
|
u_int cookie;
|
||||||
|
(void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
|
||||||
plog(XLOG_DEBUG, "gen2+ key %4d \"%s\" fi=%d ck=%d",
|
plog(XLOG_DEBUG, "gen2+ key %4d \"%s\" fi=%d ck=%d",
|
||||||
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
|
j++, ne->ne_name, ne->ne_fileid, cookie);
|
||||||
|
}
|
||||||
plog(XLOG_DEBUG, "EOF is %d", dp->dl_eof);
|
plog(XLOG_DEBUG, "EOF is %d", dp->dl_eof);
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
@ -412,7 +417,7 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
|
|||||||
ep[0].ne_fileid = mp->am_gen;
|
ep[0].ne_fileid = mp->am_gen;
|
||||||
ep[0].ne_name = ".";
|
ep[0].ne_name = ".";
|
||||||
ep[0].ne_nextentry = &ep[1];
|
ep[0].ne_nextentry = &ep[1];
|
||||||
*(u_int *) ep[0].ne_cookie = 0;
|
(void)memset(ep[0].ne_cookie, 0, sizeof(u_int));
|
||||||
|
|
||||||
/* construct ".." */
|
/* construct ".." */
|
||||||
if (mp->am_parent)
|
if (mp->am_parent)
|
||||||
@ -429,9 +434,12 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
|
|||||||
if (amuDebug(D_READDIR)) {
|
if (amuDebug(D_READDIR)) {
|
||||||
nfsentry *ne;
|
nfsentry *ne;
|
||||||
int j;
|
int j;
|
||||||
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry)
|
for (j = 0, ne = ep; ne; ne = ne->ne_nextentry) {
|
||||||
|
u_int cookie;
|
||||||
|
(void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
|
||||||
plog(XLOG_DEBUG, "gen1 key %4d \"%s\" fi=%d ck=%d",
|
plog(XLOG_DEBUG, "gen1 key %4d \"%s\" fi=%d ck=%d",
|
||||||
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
|
j++, ne->ne_name, ne->ne_fileid, cookie);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
@ -460,9 +468,9 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
|
|||||||
am_node *xp_next = next_nonerror_node(xp->am_osib);
|
am_node *xp_next = next_nonerror_node(xp->am_osib);
|
||||||
|
|
||||||
if (xp_next) {
|
if (xp_next) {
|
||||||
*(u_int *) ep->ne_cookie = xp_next->am_gen;
|
(void)memcpy(ep->ne_cookie, &xp_next->am_gen, sizeof(xp_next->am_gen));
|
||||||
} else {
|
} else {
|
||||||
*(u_int *) ep->ne_cookie = DOT_DOT_COOKIE;
|
(void)memcpy(ep->ne_cookie, &dotdotcookie, sizeof(dotdotcookie));
|
||||||
dp->dl_eof = TRUE;
|
dp->dl_eof = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,9 +496,12 @@ amfs_generic_readdir(am_node *mp, nfscookie cookie, nfsdirlist *dp, nfsentry *ep
|
|||||||
if (amuDebug(D_READDIR)) {
|
if (amuDebug(D_READDIR)) {
|
||||||
nfsentry *ne;
|
nfsentry *ne;
|
||||||
int j;
|
int j;
|
||||||
for (j=0,ne=ep; ne; ne=ne->ne_nextentry)
|
for (j=0,ne=ep; ne; ne=ne->ne_nextentry) {
|
||||||
|
u_int cookie;
|
||||||
|
(void)memcpy(&cookie, ne->ne_cookie, sizeof(cookie));
|
||||||
plog(XLOG_DEBUG, "gen2 key %4d \"%s\" fi=%d ck=%d",
|
plog(XLOG_DEBUG, "gen2 key %4d \"%s\" fi=%d ck=%d",
|
||||||
j++, ne->ne_name, ne->ne_fileid, *(u_int *)ne->ne_cookie);
|
j++, ne->ne_name, ne->ne_fileid, cookie);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -492,9 +492,10 @@ readent:
|
|||||||
|
|
||||||
/* read records */
|
/* read records */
|
||||||
buf[0] = '\0';
|
buf[0] = '\0';
|
||||||
fgets(buf, 256, passwd_fp);
|
if (fgets(buf, 256, passwd_fp) == NULL)
|
||||||
|
return NULL;
|
||||||
passwd_line++;
|
passwd_line++;
|
||||||
if (!buf || buf[0] == '\0')
|
if (buf[0] == '\0')
|
||||||
goto readent;
|
goto readent;
|
||||||
|
|
||||||
/* read user name */
|
/* read user name */
|
||||||
|
@ -164,8 +164,7 @@ nfsproc_getattr_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
|
|||||||
if (gid != hlfs_gid) {
|
if (gid != hlfs_gid) {
|
||||||
res.ns_status = NFSERR_STALE;
|
res.ns_status = NFSERR_STALE;
|
||||||
} else {
|
} else {
|
||||||
memset((char *) &uid, 0, sizeof(int));
|
(void)memcpy(&uid, argp->fh_data, sizeof(uid));
|
||||||
uid = *(u_int *) argp->fh_data;
|
|
||||||
if (plt_search(uid) != (uid2home_t *) NULL) {
|
if (plt_search(uid) != (uid2home_t *) NULL) {
|
||||||
res.ns_status = NFS_OK;
|
res.ns_status = NFS_OK;
|
||||||
un_fattr.na_fileid = uid;
|
un_fattr.na_fileid = uid;
|
||||||
@ -282,8 +281,8 @@ nfsproc_lookup_2_svc(nfsdiropargs *argp, struct svc_req *rqstp)
|
|||||||
} else { /* entry found and gid is permitted */
|
} else { /* entry found and gid is permitted */
|
||||||
un_fattr.na_fileid = untab[idx].uid;
|
un_fattr.na_fileid = untab[idx].uid;
|
||||||
res.dr_u.dr_drok_u.drok_attributes = un_fattr;
|
res.dr_u.dr_drok_u.drok_attributes = un_fattr;
|
||||||
memset((char *) &un_fhandle, 0, sizeof(am_nfs_fh));
|
memset(&un_fhandle, 0, sizeof(un_fhandle));
|
||||||
*(u_int *) un_fhandle.fh_data = (u_int) untab[idx].uid;
|
memcpy(un_fhandle.fh_data, &untab[idx].uid, sizeof(untab[idx].uid));
|
||||||
xstrlcpy((char *) &un_fhandle.fh_data[sizeof(int)],
|
xstrlcpy((char *) &un_fhandle.fh_data[sizeof(int)],
|
||||||
untab[idx].username,
|
untab[idx].username,
|
||||||
sizeof(am_nfs_fh) - sizeof(int));
|
sizeof(am_nfs_fh) - sizeof(int));
|
||||||
@ -338,8 +337,7 @@ nfsproc_readlink_2_svc(am_nfs_fh *argp, struct svc_req *rqstp)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (groupid == hlfs_gid) {
|
if (groupid == hlfs_gid) {
|
||||||
memset((char *) &userid, 0, sizeof(int));
|
memcpy(&userid, argp->fh_data, sizeof(userid));
|
||||||
userid = *(u_int *) argp->fh_data;
|
|
||||||
username = (char *) &argp->fh_data[sizeof(int)];
|
username = (char *) &argp->fh_data[sizeof(int)];
|
||||||
if (!(res.rlr_u.rlr_data_u = mailbox(userid, username)))
|
if (!(res.rlr_u.rlr_data_u = mailbox(userid, username)))
|
||||||
return (nfsreadlinkres *) NULL;
|
return (nfsreadlinkres *) NULL;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user