From ddc5ad3763d0a8171373a8ae0ccb04778023bdf7 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 20 Mar 2009 03:49:16 +0000 Subject: [PATCH] STABLE14-ubik-recovery-use-file-number-not-hardcoded-zero-20090319 LICENSE IPL10 don't hardcode DB0, use the file number which is being recovered (cherry picked from commit ef5f6f988c352db58e8b9df422b417cc199b4837) --- src/ubik/recovery.c | 10 +++++----- src/ubik/remote.c | 10 +++++----- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/ubik/recovery.c b/src/ubik/recovery.c index 301546e77..5a2f76783 100644 --- a/src/ubik/recovery.c +++ b/src/ubik/recovery.c @@ -578,7 +578,7 @@ urecovery_Interact(void *dummy) } #ifndef OLD_URECOVERY flen = length; - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600); if (fd < 0) { code = errno; @@ -639,13 +639,13 @@ urecovery_Interact(void *dummy) #ifdef OLD_URECOVERY (*ubik_dbase->sync) (ubik_dbase, 0); /* get data out first */ #else - afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB0", ubik_dbase->pathName); + afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); #ifdef AFS_NT40_ENV - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); code = unlink(pbuffer); if (!code) code = rename(tbuffer, pbuffer); - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); #endif if (!code) code = rename(pbuffer, tbuffer); @@ -659,7 +659,7 @@ urecovery_Interact(void *dummy) #ifndef OLD_URECOVERY } #ifdef AFS_NT40_ENV - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); unlink(pbuffer); #endif #endif diff --git a/src/ubik/remote.c b/src/ubik/remote.c index 1ec8b7bb6..3d543d47c 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -550,7 +550,7 @@ SDISK_SendFile(rxcall, file, length, avers) (*dbase->setlabel) (dbase, file, &tversion); /* setlabel does sync */ #ifndef OLD_URECOVERY flen = length; - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); fd = open(pbuffer, O_CREAT | O_RDWR | O_TRUNC, 0600); if (fd < 0) { code = errno; @@ -605,13 +605,13 @@ SDISK_SendFile(rxcall, file, length, avers) #ifdef OLD_URECOVERY (*ubik_dbase->sync) (dbase, file); #else - afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB0", ubik_dbase->pathName); + afs_snprintf(tbuffer, sizeof(tbuffer), "%s.DB%s%d", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); #ifdef AFS_NT40_ENV - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); code = unlink(pbuffer); if (!code) code = rename(tbuffer, pbuffer); - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.TMP", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.TMP", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); #endif if (!code) code = rename(pbuffer, tbuffer); @@ -622,7 +622,7 @@ SDISK_SendFile(rxcall, file, length, avers) #ifndef OLD_URECOVERY } #ifdef AFS_NT40_ENV - afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB0.OLD", ubik_dbase->pathName); + afs_snprintf(pbuffer, sizeof(pbuffer), "%s.DB%s%d.OLD", ubik_dbase->pathName, (file<0)?"SYS":"", (file<0)?-file:file); unlink(pbuffer); #endif #endif -- 2.39.5