@@ -32,6 +32,8 @@ static int grab_excl_lock_file(const char *backup_dir, const char *backup_id, bo
3232static int grab_shared_lock_file (pgBackup * backup );
3333static int wait_shared_owners (pgBackup * backup );
3434
35+
36+ static void unlink_lock_atexit (bool fatal , void * userdata );
3537static void unlock_backup (const char * backup_dir , const char * backup_id , bool exclusive );
3638static void release_excl_lock_file (const char * backup_dir );
3739static void release_shared_lock_file (const char * backup_dir );
@@ -83,8 +85,8 @@ timelineInfoFree(void *tliInfo)
8385}
8486
8587/* Iterate over locked backups and unlock them */
86- static void
87- unlink_lock_atexit (void )
88+ void
89+ unlink_lock_atexit (bool unused_fatal , void * unused_userdata )
8890{
8991 int i ;
9092
@@ -94,7 +96,7 @@ unlink_lock_atexit(void)
9496 for (i = 0 ; i < parray_num (locks ); i ++ )
9597 {
9698 LockInfo * lock = (LockInfo * ) parray_get (locks , i );
97- unlock_backup (lock -> backup_dir , lock -> backup_dir , lock -> exclusive );
99+ unlock_backup (lock -> backup_dir , lock -> backup_id , lock -> exclusive );
98100 }
99101
100102 parray_walk (locks , pg_free );
@@ -267,7 +269,7 @@ lock_backup(pgBackup *backup, bool strict, bool exclusive)
267269 */
268270 if (!backup_lock_exit_hook_registered )
269271 {
270- atexit (unlink_lock_atexit );
272+ pgut_atexit_push (unlink_lock_atexit , NULL );
271273 backup_lock_exit_hook_registered = true;
272274 }
273275
0 commit comments