Skip to content

Commit d4a4976

Browse files
Martin Ågrengitster
authored andcommitted
builtin/gc: don't peek into struct lock_file
A `struct lock_file` is pretty much just a wrapper around a tempfile. But it's easy enough to avoid relying on this. Use the wrappers that the lock file API provides rather than peeking at the temp file or even into *its* internals. Signed-off-by: Martin Ågren <[email protected]> Reviewed-by: Derrick Stolee <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 71ca53e commit d4a4976

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

builtin/gc.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ static void process_log_file(void)
9292
*/
9393
int saved_errno = errno;
9494
fprintf(stderr, _("Failed to fstat %s: %s"),
95-
get_tempfile_path(log_lock.tempfile),
95+
get_lock_file_path(&log_lock),
9696
strerror(saved_errno));
9797
fflush(stderr);
9898
commit_lock_file(&log_lock);
@@ -1518,7 +1518,7 @@ static int update_background_schedule(int run_maintenance)
15181518
strvec_split(&crontab_list.args, crontab_name);
15191519
strvec_push(&crontab_list.args, "-l");
15201520
crontab_list.in = -1;
1521-
crontab_list.out = dup(lk.tempfile->fd);
1521+
crontab_list.out = dup(get_lock_file_fd(&lk));
15221522
crontab_list.git_cmd = 0;
15231523

15241524
if (start_command(&crontab_list)) {
@@ -1533,7 +1533,7 @@ static int update_background_schedule(int run_maintenance)
15331533
* Read from the .lock file, filtering out the old
15341534
* schedule while appending the new schedule.
15351535
*/
1536-
cron_list = fdopen(lk.tempfile->fd, "r");
1536+
cron_list = fdopen(get_lock_file_fd(&lk), "r");
15371537
rewind(cron_list);
15381538

15391539
strvec_split(&crontab_edit.args, crontab_name);

0 commit comments

Comments
 (0)