From 1133cc441862f3f0d44f0ab380a7274ead672b0f Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 14 Feb 2008 19:19:38 +0000 Subject: [PATCH] windows-vnovol-20080214 LICENSE MIT avoid a crash when logging VNOVOL errors returned from cm_CheckOfflineVolume --- src/WINNT/afsd/cm_conn.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/WINNT/afsd/cm_conn.c b/src/WINNT/afsd/cm_conn.c index 8413a1975f..cc18ad2c62 100644 --- a/src/WINNT/afsd/cm_conn.c +++ b/src/WINNT/afsd/cm_conn.c @@ -432,15 +432,17 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, break; } - /* Log server being offline for this volume */ - sprintf(addr, "%d.%d.%d.%d", - ((serverp->addr.sin_addr.s_addr & 0xff)), - ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), - ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), - ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); + if (serverp && fidp) { + /* Log server being offline for this volume */ + sprintf(addr, "%d.%d.%d.%d", + ((serverp->addr.sin_addr.s_addr & 0xff)), + ((serverp->addr.sin_addr.s_addr & 0xff00)>> 8), + ((serverp->addr.sin_addr.s_addr & 0xff0000)>> 16), + ((serverp->addr.sin_addr.s_addr & 0xff000000)>> 24)); - osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume); - LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume); + osi_Log2(afsd_logp, format, osi_LogSaveString(afsd_logp,addr), fidp->volume); + LogEvent(EVENTLOG_WARNING_TYPE, msgID, addr, fidp->volume); + } /* Mark server offline for this volume */ if (!serversp && fidp) { @@ -450,6 +452,7 @@ cm_Analyze(cm_conn_t *connp, cm_user_t *userp, cm_req_t *reqp, free_svr_list = 1; } } + lock_ObtainWrite(&cm_serverLock); for (tsrp = serversp; tsrp; tsrp=tsrp->next) { if (tsrp->server == serverp) {