From ef5f6f988c352db58e8b9df422b417cc199b4837 Mon Sep 17 00:00:00 2001 From: Derrick Brashear Date: Fri, 20 Mar 2009 03:48:52 +0000 Subject: [PATCH] ubik-recovery-use-file-number-not-hardcoded-zero-20090319 LICENSE IPL10 don't hardcode DB0, use the file number which is being recovered --- 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 2ef23f89c..1d4aac757 100644 --- a/src/ubik/recovery.c +++ b/src/ubik/recovery.c @@ -611,7 +611,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; @@ -672,13 +672,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); @@ -692,7 +692,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 cd9786f46..077a9efb9 100644 --- a/src/ubik/remote.c +++ b/src/ubik/remote.c @@ -533,7 +533,7 @@ SDISK_SendFile(register struct rx_call *rxcall, afs_int32 file, (*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; @@ -588,13 +588,13 @@ SDISK_SendFile(register struct rx_call *rxcall, afs_int32 file, #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); @@ -605,7 +605,7 @@ SDISK_SendFile(register struct rx_call *rxcall, afs_int32 file, #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