[Toybox] TT.cwd unused in tar?

enh enh at google.com
Tue Mar 26 15:00:58 PDT 2019


(this is the background to the xabspath patch i just sent out...)

i assume there's a future patch that actually _reads_ TT.cwd, so that
we won't want https://android-review.googlesource.com/c/platform/external/toybox/+/933053
(pasted below for convenience):

tar: delete unused variable.

Not all processes can read the root directory, required to allow
xabspath to work. Since this data is never used, just delete the code
which tries to do this.

Bug: 129355987
Test: compiles
Change-Id: Ic9b99326121dd64459a698a93895336864c6fc51
---
M toys/pending/tar.c
1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/toys/pending/tar.c b/toys/pending/tar.c
index 97e699b..b2736cb 100644
--- a/toys/pending/tar.c
+++ b/toys/pending/tar.c
@@ -570,7 +570,7 @@
 void tar_main(void)
 {
   struct arg_list *tmp;
-  char *s, **args = toys.optargs;
+  char **args = toys.optargs;

   // When extracting to command
   signal(SIGPIPE, SIG_IGN);
@@ -592,8 +592,6 @@

   // Get destination directory
   if (TT.C) xchdir(TT.C);
-  TT.cwd = xabspath(s = xgetcwd(), 1);
-  free(s);

   // Are we reading?
   if (FLAG(x)||FLAG(t)) {



More information about the Toybox mailing list