butc: initialize startTime before it is used
[openafs.git] / src / butc / lwps.c
index cce1bc7..f479b78 100644 (file)
@@ -116,7 +116,6 @@ extern struct tapeConfig globalTapeConfig;
 extern struct deviceSyncNode *deviceLatch;
 extern char globalCellName[];
 struct timeval tp;
-struct timezone tzp;
 
 /* forward declaration */
 afs_int32 readVolumeHeader(char *, afs_int32, struct volumeHeader *);
@@ -565,7 +564,7 @@ PrintPrompt(int flag, char *name, int dumpid)
        break;
 
     case SAVEDBOPCODE:         /* Mount for savedb */
-       printf("Please insert a writeable tape %s for the database dump",
+       printf("Please insert a writable tape %s for the database dump",
               tapename);
        break;
 
@@ -1639,6 +1638,7 @@ Restorer(void *param) {
     time_t startTime, endTime;
     afs_int32 goodrestore = 0;
 
+    afs_pthread_setname_self("restorer");
     taskId = newNode->taskID;
     setStatus(taskId, DRIVE_WAIT);
     EnterDeviceQueue(deviceLatch);
@@ -1647,6 +1647,7 @@ Restorer(void *param) {
     printf("\n\n");
     TLog(taskId, "Restore\n");
 
+    startTime = time(0);
     memset(&tapeInfo, 0, sizeof(tapeInfo));
     if (!CONF_XBSA) {
        tapeInfo.structVersion = BUTM_MAJORVERSION;
@@ -1682,7 +1683,6 @@ Restorer(void *param) {
        ERROR_EXIT(TC_NOMEMORY);
     memset(bufferBlock, 0, allocbufferSize);
 
-    startTime = time(0);
     for (rparams.frag = 0; (rparams.frag < newNode->arraySize);
         rparams.frag++) {
        RestoreDesc = &Restore[rparams.frag];
@@ -1811,7 +1811,6 @@ GetNewLabel(struct butm_tapeInfo *tapeInfoPtr, char *pName, char *AFSName,
            struct butm_tapeLabel *tapeLabel)
 {
     struct timeval tp;
-    struct timezone tzp;
     afs_uint32 size;
 
     memset(tapeLabel, 0, sizeof(struct butm_tapeLabel));
@@ -1823,7 +1822,7 @@ GetNewLabel(struct butm_tapeInfo *tapeInfoPtr, char *pName, char *AFSName,
     } else {
        size = 0;               /* no tape size */
     }
-    gettimeofday(&tp, &tzp);
+    gettimeofday(&tp, NULL);
 
     tapeLabel->structVersion = CUR_TAPE_VERSION;
     tapeLabel->creationTime = tp.tv_sec;
@@ -1971,13 +1970,12 @@ tapeExpired(struct butm_tapeLabel *tapeLabelPtr)
 {
     Date expiration;
     struct timeval tp;
-    struct timezone tzp;
 
     expiration = ExpirationDate(tapeLabelPtr->dumpid);
     if (!expiration)
        expiration = tapeLabelPtr->expirationDate;
 
-    gettimeofday(&tp, &tzp);
+    gettimeofday(&tp, NULL);
     return ((expiration < tp.tv_sec) ? 1 : 0);
 }
 
@@ -2107,6 +2105,7 @@ Labeller(void *param)
     afs_uint32 taskId;
     afs_int32 code = 0;
 
+    afs_pthread_setname_self("labeller");
     taskId = labelIfPtr->taskId;
     setStatus(taskId, DRIVE_WAIT);
     EnterDeviceQueue(deviceLatch);