[v2,2/6,gdb/testsuite] Improve variable names in lock_file_{acquire, release}

Message ID 20260929110921.1910094-2-tdevries@suse.de
State New
Headers
Series [v2,1/6,gdb/testsuite] Add gdb.testsuite/lock.exp |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gdb_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_gdb_build--master-arm success Build passed

Commit Message

Tom de Vries Sept. 29, 2026, 11:09 a.m. UTC
  In lock_file_acquire we assign the result of a call to proc open to a variable
called rc.

Use fh for file handle instead.

Then use the variable names fh and lockfile as used in lock_file_acquire in
lock_file_release.
---
 gdb/testsuite/lib/gdb-utils.exp | 21 ++++++++++++---------
 1 file changed, 12 insertions(+), 9 deletions(-)
  

Patch

diff --git a/gdb/testsuite/lib/gdb-utils.exp b/gdb/testsuite/lib/gdb-utils.exp
index 5d6165f9ba3..56d8e80f152 100644
--- a/gdb/testsuite/lib/gdb-utils.exp
+++ b/gdb/testsuite/lib/gdb-utils.exp
@@ -188,14 +188,14 @@  proc lock_file_acquire {lockfile} {
     while {true} {
 	try {
 	    open $lockfile {WRONLY CREAT EXCL}
-	} on ok {rc} {
+	} on ok {fh} {
 	    set msg "locked by $::subdir/${::gdb_test_file_name}.exp"
 	    verbose -log "lock file: $msg"
 	    # For debugging, put info in the lockfile about who owns
 	    # it.
-	    puts  $rc $msg
-	    flush $rc
-	    return [list $rc $lockfile]
+	    puts $fh $msg
+	    flush $fh
+	    return [list $fh $lockfile]
 	} on error {} {
 	    # Ignore and try again.
 	}
@@ -208,17 +208,20 @@  proc lock_file_acquire {lockfile} {
 proc lock_file_release {info} {
     verbose -log "releasing lock file: $::subdir/${::gdb_test_file_name}.exp"
 
+    set fh [lindex $info 0]
+    set lockfile [lindex $info 1]
+
     try {
-	fconfigure [lindex $info 0]
+	fconfigure $fh
     } on error {} {
 	error "invalid lock"
     }
 
     try {
-	close [lindex $info 0]
-	file delete -force [lindex $info 1]
-    } on error {rc} {
-	error "Error releasing lockfile: '$rc'"
+	close $fh
+	file delete -force $lockfile
+    } on error {err_msg} {
+	error "Error releasing lockfile: '$err_msg'"
     }
 
     return ""