[haiku-commits] Change in haiku[master]: Expander: Fix dead nested assignment

  • From: Gerrit <review@xxxxxxxxxxxxxxxxxxx>
  • To: waddlesplash <waddlesplash@xxxxxxxxx>, haiku-commits@xxxxxxxxxxxxx
  • Date: Mon, 7 Dec 2020 11:27:29 +0000

From Murai Takashi <tmurai01@xxxxxxxxx>:

Murai Takashi has uploaded this change for review. ( 
https://review.haiku-os.org/c/haiku/+/3473 ;)


Change subject: Expander: Fix dead nested assignment
......................................................................

Expander: Fix dead nested assignment

Fix value stored to 'status' is never read.
Pointed out by Clang Static Analyzer.

Change-Id: I0bbeafb74168d566128b53f8ad40e71218c78c45
---
M src/apps/expander/ExpanderThread.cpp
1 file changed, 8 insertions(+), 7 deletions(-)



  git pull ssh://git.haiku-os.org:22/haiku refs/changes/73/3473/1

diff --git a/src/apps/expander/ExpanderThread.cpp 
b/src/apps/expander/ExpanderThread.cpp
index 15721be..280e90e 100644
--- a/src/apps/expander/ExpanderThread.cpp
+++ b/src/apps/expander/ExpanderThread.cpp
@@ -54,15 +54,16 @@
        if ((status = GetDataStore()->FindRef("srcRef", &srcRef)) != B_OK)
                return status;

-       if ((status = GetDataStore()->FindRef("destRef", &destRef)) == B_OK) {
-               BPath path(&destRef);
-               chdir(path.Path());
-       }
+       if ((status = GetDataStore()->FindRef("destRef", &destRef)) != B_OK)
+               return status;

        if ((status = GetDataStore()->FindString("cmd", &cmd)) != B_OK)
                return status;

-       BPath path(&srcRef);
+       BPath path(&destRef);
+       chdir(path.Path());
+
+       path.SetTo(&srcRef);
        BString pathString(path.Path());
        pathString.CharacterEscape("\\\"$`", '\\');
        pathString.Prepend("\"");
@@ -213,7 +214,7 @@
        int old_err = dup(2);

        int filedes[2];
-
+
        // create new pipe FDs as stdout, stderr
        pipe(filedes);  dup2(filedes[1], 1); close(filedes[1]);
        out = filedes[0]; // Read from out, taken from cmd's stdout
@@ -250,7 +251,7 @@
                if (ioctl(slave, TIOCSCTTY, NULL) != 0)
                        return -1;

-               dup2(slave, 0);
+               dup2(slave, 0);
                close(slave);

                // "load" command.

--
To view, visit https://review.haiku-os.org/c/haiku/+/3473
To unsubscribe, or for help writing mail filters, visit 
https://review.haiku-os.org/settings

Gerrit-Project: haiku
Gerrit-Branch: master
Gerrit-Change-Id: I0bbeafb74168d566128b53f8ad40e71218c78c45
Gerrit-Change-Number: 3473
Gerrit-PatchSet: 1
Gerrit-Owner: Murai Takashi <tmurai01@xxxxxxxxx>
Gerrit-MessageType: newchange

Other related posts:

  • » [haiku-commits] Change in haiku[master]: Expander: Fix dead nested assignment - Gerrit