mirror of
https://git.openafs.org/openafs.git
synced 2025-01-19 07:20:11 +00:00
STABLE14-initialize-variables-to-avoid-logic-issues-20081027
LICENSE IPL10
make sure any variable whose value is used will be initialized before that
value is used. (these aren't just warnings)
(cherry picked from commit fc78255c1d
)
This commit is contained in:
parent
02e191d208
commit
4899132ac1
@ -2202,7 +2202,7 @@ int
|
||||
uafs_LookupName(char *path, struct usr_vnode *parentVp,
|
||||
struct usr_vnode **vpp, int follow, int no_eval_mtpt)
|
||||
{
|
||||
int code;
|
||||
int code = 0;
|
||||
int linkCount;
|
||||
struct usr_vnode *vp;
|
||||
struct usr_vnode *nextVp;
|
||||
|
@ -491,15 +491,16 @@ afs_BlackListOnce(struct vrequest *areq, struct VenusFid *afid,
|
||||
}
|
||||
}
|
||||
afs_PutVolume(tvp, READ_LOCK);
|
||||
for (i = 0; i < MAXHOSTS; i++) {
|
||||
if (tvp->serverHost[i] && areq->skipserver[i] == 0) {
|
||||
serversleft = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return serversleft;
|
||||
}
|
||||
}
|
||||
for (i = 0; i < MAXHOSTS; i++) {
|
||||
if (tvp->serverHost[i] && areq->skipserver[i] == 0) {
|
||||
serversleft = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return serversleft;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
@ -79,7 +79,7 @@ ka_CellConfig(const char *dir)
|
||||
char *
|
||||
ka_LocalCell(void)
|
||||
{
|
||||
int code;
|
||||
int code = 0;
|
||||
|
||||
LOCK_GLOBAL_MUTEX;
|
||||
if (conf) {
|
||||
|
@ -27,7 +27,7 @@ main(int argc, char *argv[])
|
||||
{
|
||||
char oldpassword[512];
|
||||
char password[512];
|
||||
int rc;
|
||||
int rc = 1;
|
||||
|
||||
if (fgets(oldpassword, 512, stdin))
|
||||
while (fgets(password, 512, stdin)) {
|
||||
|
@ -395,8 +395,9 @@ WalkNextChain(char map[], /* one byte per db entry */
|
||||
struct prentry c; /* continuation entry */
|
||||
afs_int32 na; /* next thread */
|
||||
int ni;
|
||||
afs_int32 eid;
|
||||
int count; /* number of members */
|
||||
afs_int32 eid = 0;
|
||||
int count = 0; /* number of members, set to > 9999 if */
|
||||
/* list ends early */
|
||||
int i;
|
||||
int noErrors = 1;
|
||||
int length; /* length of chain */
|
||||
@ -410,7 +411,6 @@ WalkNextChain(char map[], /* one byte per db entry */
|
||||
head = ntohl(e->next);
|
||||
eid = ntohl(e->id);
|
||||
bit = MAP_CONT;
|
||||
count = 0; /* set to >9999 if list ends early */
|
||||
#if defined(SUPERGROUPS)
|
||||
sgcount = 0;
|
||||
sghead = ntohl(g->next);
|
||||
@ -713,7 +713,7 @@ WalkOwnedChain(char map[], /* one byte per db entry */
|
||||
struct prentry c; /* continuation entry */
|
||||
afs_int32 na; /* next thread */
|
||||
int ni;
|
||||
afs_int32 eid;
|
||||
afs_int32 eid = 0;
|
||||
int length; /* length of chain */
|
||||
|
||||
if (e) {
|
||||
|
@ -133,8 +133,9 @@ int
|
||||
CommandProc(register struct cmd_syndesc *a_as, void *arock)
|
||||
{
|
||||
register int i;
|
||||
register long code;
|
||||
long cc, upos, gpos;
|
||||
long code = 0;
|
||||
long cc, upos;
|
||||
long gpos = 0;
|
||||
struct prentry uentry, gentry;
|
||||
struct ubik_hdr *uh;
|
||||
char *dfile = 0;
|
||||
|
@ -489,18 +489,19 @@ SDISK_SendFile(rxcall, file, length, avers)
|
||||
struct ubik_version *avers;
|
||||
{
|
||||
register afs_int32 code;
|
||||
register struct ubik_dbase *dbase;
|
||||
struct ubik_dbase *dbase = NULL;
|
||||
char tbuffer[1024];
|
||||
afs_int32 offset;
|
||||
struct ubik_version tversion;
|
||||
register int tlen;
|
||||
struct rx_peer *tpeer;
|
||||
struct rx_connection *tconn;
|
||||
afs_uint32 otherHost;
|
||||
afs_uint32 otherHost = 0;
|
||||
#ifndef OLD_URECOVERY
|
||||
char pbuffer[1028];
|
||||
int flen, fd = -1;
|
||||
afs_int32 epoch, pass;
|
||||
afs_int32 epoch = 0;
|
||||
afs_int32 pass;
|
||||
#endif
|
||||
|
||||
/* send the file back to the requester */
|
||||
@ -634,8 +635,10 @@ SDISK_SendFile(rxcall, file, length, avers)
|
||||
#ifndef OLD_URECOVERY
|
||||
unlink(pbuffer);
|
||||
/* Failed to sync. Allow reads again for now. */
|
||||
tversion.epoch = epoch;
|
||||
(*dbase->setlabel) (dbase, file, &tversion);
|
||||
if (dbase != NULL) {
|
||||
tversion.epoch = epoch;
|
||||
(*dbase->setlabel) (dbase, file, &tversion);
|
||||
}
|
||||
#endif
|
||||
ubik_print
|
||||
("Ubik: Synchronize database with server %s failed (error = %d)\n",
|
||||
|
@ -1104,7 +1104,8 @@ void
|
||||
h_Enumerate_r(int (*proc) (), struct host *enumstart, char *param)
|
||||
{
|
||||
register struct host *host, *next;
|
||||
register int held, nheld;
|
||||
int held = 0;
|
||||
int nheld = 0;
|
||||
|
||||
if (hostCount == 0) {
|
||||
return;
|
||||
@ -1947,9 +1948,9 @@ struct client *
|
||||
h_FindClient_r(struct rx_connection *tcon)
|
||||
{
|
||||
register struct client *client;
|
||||
register struct host *host;
|
||||
struct host *host = NULL;
|
||||
struct client *oldClient;
|
||||
afs_int32 viceid;
|
||||
afs_int32 viceid = 0;
|
||||
afs_int32 expTime;
|
||||
afs_int32 code;
|
||||
int authClass;
|
||||
@ -3032,7 +3033,7 @@ int
|
||||
hashDelete_r(afs_uint32 addr, afs_uint16 port, struct host *
|
||||
host)
|
||||
{
|
||||
int flag;
|
||||
int flag = 0;
|
||||
register struct h_AddrHashChain **hp, *th;
|
||||
|
||||
for (hp = &hostAddrHashTable[h_HashIndex(addr)]; (th = *hp);) {
|
||||
|
@ -501,7 +501,9 @@ ReadAllEntries(struct vlheader *header)
|
||||
int freecount = 0, mhcount = 0, vlcount = 0;
|
||||
int rwcount = 0, rocount = 0, bkcount = 0;
|
||||
struct nvlentry vlentry;
|
||||
afs_uint32 addr, entrysize, maxvolid = 0;
|
||||
afs_uint32 addr;
|
||||
afs_uint32 entrysize = 0;
|
||||
afs_uint32 maxvolid = 0;
|
||||
|
||||
if (verbose)
|
||||
printf("Read each entry in the database\n");
|
||||
@ -570,7 +572,8 @@ ReadAllEntries(struct vlheader *header)
|
||||
entrysize = VL_ADDREXTBLK_SIZE;
|
||||
mhcount++;
|
||||
} else {
|
||||
printf("Unknown entry at %u\n", addr);
|
||||
printf("Unknown entry at %u. Aborting\n", addr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (verbose) {
|
||||
@ -1111,11 +1114,12 @@ WorkerBee(struct cmd_syndesc *as, void *arock)
|
||||
if (verbose)
|
||||
printf("Verify each volume entry\n");
|
||||
for (i = 0; i < maxentries; i++) {
|
||||
int nextp;
|
||||
int reft;
|
||||
int hash, nexthash = 0;
|
||||
int *nextpp;
|
||||
char *which;
|
||||
int nextp = 0;
|
||||
int reft = 0;
|
||||
int hash = 0;
|
||||
int nexthash = 0;
|
||||
int *nextpp = NULL;
|
||||
char *which = NULL;
|
||||
|
||||
if (record[i].type == 0)
|
||||
continue;
|
||||
|
@ -507,7 +507,7 @@ stream_fdopen(FD_t fd)
|
||||
StreamHandle_t *
|
||||
stream_open(const char *filename, const char *mode)
|
||||
{
|
||||
FD_t fd;
|
||||
FD_t fd = INVALID_FD;
|
||||
|
||||
if (strcmp(mode, "r") == 0) {
|
||||
fd = OS_OPEN(filename, O_RDONLY, 0);
|
||||
|
@ -1711,7 +1711,7 @@ CompareVolumes(const void *_p1, const void *_p2)
|
||||
void
|
||||
GetVolumeSummary(VolumeId singleVolumeNumber)
|
||||
{
|
||||
DIR *dirp;
|
||||
DIR *dirp = NULL;
|
||||
afs_int32 nvols = 0;
|
||||
struct VolumeSummary *vsp, vs;
|
||||
struct VolumeDiskHeader diskHeader;
|
||||
@ -1929,7 +1929,7 @@ DoSalvageVolumeGroup(register struct InodeSummary *isp, int nVols)
|
||||
int check;
|
||||
Inode ino;
|
||||
int dec_VGLinkH = 0;
|
||||
int VGLinkH_p1;
|
||||
int VGLinkH_p1 =0;
|
||||
FdHandle_t *fdP = NULL;
|
||||
|
||||
VGLinkH_cnt = 0;
|
||||
|
@ -1355,7 +1355,8 @@ VDetachVolume_r(Error * ec, Volume * vp)
|
||||
{
|
||||
VolumeId volume;
|
||||
struct DiskPartition64 *tpartp;
|
||||
int notifyServer, useDone;
|
||||
int notifyServer = 0;
|
||||
int useDone = FSYNC_ON;
|
||||
|
||||
*ec = 0; /* always "succeeds" */
|
||||
if (programType == volumeUtility) {
|
||||
|
@ -3032,7 +3032,8 @@ GetTrans(struct nvldbentry *vldbEntryPtr, afs_int32 index,
|
||||
{
|
||||
afs_int32 volid;
|
||||
struct volser_status tstatus;
|
||||
int code, rcode, tcode;
|
||||
int code = 0;
|
||||
int rcode, tcode;
|
||||
char hoststr[16];
|
||||
|
||||
*connPtr = (struct rx_connection *)0;
|
||||
@ -3170,7 +3171,8 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
|
||||
afs_int32 afrompart, int forceflag)
|
||||
{
|
||||
char vname[64];
|
||||
afs_int32 code, vcode, rcode, tcode;
|
||||
afs_int32 code = 0;
|
||||
afs_int32 vcode, rcode, tcode;
|
||||
afs_int32 cloneVolId, roVolId;
|
||||
struct replica *replicas = 0;
|
||||
struct nvldbentry entry, storeEntry;
|
||||
@ -3185,12 +3187,15 @@ UV_ReleaseVolume(afs_int32 afromvol, afs_int32 afromserver,
|
||||
int islocked = 0;
|
||||
afs_int32 clonetid = 0, onlinetid;
|
||||
afs_int32 fromtid = 0;
|
||||
afs_uint32 fromdate, thisdate;
|
||||
afs_uint32 fromdate = 0;
|
||||
afs_uint32 thisdate;
|
||||
time_t tmv;
|
||||
int s;
|
||||
manyDests tr;
|
||||
manyResults results;
|
||||
int rwindex, roindex, roclone, roexists;
|
||||
afs_int32 rwcrdate, rwupdate, clcrdate;
|
||||
afs_int32 rwcrdate = 0;
|
||||
afs_int32 rwupdate, clcrdate;
|
||||
struct rtime {
|
||||
int validtime;
|
||||
afs_uint32 uptime;
|
||||
@ -5297,7 +5302,8 @@ static afs_int32
|
||||
CheckVolume(volintInfo * volumeinfo, afs_int32 aserver, afs_int32 apart,
|
||||
afs_int32 * modentry, afs_uint32 * maxvolid)
|
||||
{
|
||||
int idx, j;
|
||||
int idx = 0;
|
||||
int j;
|
||||
afs_int32 code, error = 0;
|
||||
struct nvldbentry entry, storeEntry;
|
||||
char pname[10];
|
||||
@ -5776,7 +5782,8 @@ UV_SyncVolume(afs_int32 aserver, afs_int32 apart, char *avolname, int flags)
|
||||
{
|
||||
struct rx_connection *aconn = 0;
|
||||
afs_int32 j, k, code, vcode, error = 0;
|
||||
afs_int32 tverbose, mod, modified = 0;
|
||||
afs_int32 tverbose;
|
||||
afs_int32 mod, modified = 0;
|
||||
struct nvldbentry vldbentry;
|
||||
afs_int32 volumeid = 0;
|
||||
volEntries volumeInfo;
|
||||
@ -5787,17 +5794,19 @@ UV_SyncVolume(afs_int32 aserver, afs_int32 apart, char *avolname, int flags)
|
||||
volumeInfo.volEntries_val = (volintInfo *) 0;
|
||||
volumeInfo.volEntries_len = 0;
|
||||
|
||||
if (!aserver && (flags & 1)) {
|
||||
/* fprintf(STDERR,"Partition option requires a server option\n"); */
|
||||
ERROR_EXIT(EINVAL);
|
||||
}
|
||||
|
||||
/* Turn verbose logging off and do our own verbose logging */
|
||||
/* tverbose must be set before we call ERROR_EXIT() */
|
||||
|
||||
tverbose = verbose;
|
||||
if (flags & 2)
|
||||
tverbose = 1;
|
||||
verbose = 0;
|
||||
|
||||
if (!aserver && (flags & 1)) {
|
||||
/* fprintf(STDERR,"Partition option requires a server option\n"); */
|
||||
ERROR_EXIT(EINVAL);
|
||||
}
|
||||
|
||||
/* Read the VLDB entry */
|
||||
vcode = VLDB_GetEntryByName(avolname, &vldbentry);
|
||||
if (vcode && (vcode != VL_NOENT)) {
|
||||
|
Loading…
Reference in New Issue
Block a user