unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] lei: use open() perlop for -C (chdir)
@ 2021-06-22 10:04 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2021-06-22 10:04 UTC (permalink / raw)
  To: meta

This is for consistency with the open() at initial accept, in
case we hit a code path which expects Perl directory handles
rather than "file handles".  Both work with the chdir() perlop
(fchdir(2), in our case).
---
 lib/PublicInbox/LEI.pm | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/lib/PublicInbox/LEI.pm b/lib/PublicInbox/LEI.pm
index 546fa773..cffe4dce 100644
--- a/lib/PublicInbox/LEI.pm
+++ b/lib/PublicInbox/LEI.pm
@@ -762,11 +762,7 @@ sub dispatch {
 				next if $d eq ''; # same as git(1)
 				chdir $d or return fail($self, "cd $d: $!");
 			}
-			if (delete $self->{3}) { # update cwd for rel2abs
-				opendir my $dh, '.' or
-					return fail($self, "opendir . $!");
-				$self->{3} = $dh;
-			}
+			open $self->{3}, '.' or return fail($self, "open . $!");
 		}
 		$cb->($self, @argv);
 	} elsif (grep(/\A-/, $cmd, @argv)) { # --help or -h only

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-06-22 10:04 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-06-22 10:04 [PATCH] lei: use open() perlop for -C (chdir) Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).