Did a patch via git format-patch command:

Signed-off-by: Markus Gothe <[email protected]>
---
 miscutils/lsscsi.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/miscutils/lsscsi.c b/miscutils/lsscsi.c
index d7cd510..8272ab5 100644
--- a/miscutils/lsscsi.c
+++ b/miscutils/lsscsi.c
@@ -25,6 +25,8 @@

 #include "libbb.h"

+static const char scsi_dir[] ALIGN1 = "/sys/bus/scsi/devices";
+
 static char *get_line(const char *filename, char *buf, unsigned *bufsize_p)
 {
        unsigned bufsize = *bufsize_p;
@@ -53,7 +55,7 @@ int lsscsi_main(int argc UNUSED_PARAM, char **argv 
UNUSED_PARAM)
        struct dirent *de;
        DIR *dir;

-       xchdir("/sys/bus/scsi/devices");
+       xchdir(scsi_dir);

        dir = xopendir(".");
        while ((de = readdir(dir)) != NULL) {
@@ -112,7 +114,7 @@ int lsscsi_main(int argc UNUSED_PARAM, char **argv 
UNUSED_PARAM)
                );
                /* TODO: also output device column, e.g. "/dev/sdX" */

-               xchdir("..");
+               xchdir(scsi_dir);
        }

        if (ENABLE_FEATURE_CLEAN_UP)
--
1.9.5 (Apple Git-50.3)


On 21 Oct 2017, at 19:21 , Markus Gothe <[email protected]> wrote:

> This patch fixes a bug when having more than 1 device exposed by the 
> SCSI-layer, notably USB-disks, which creates entries like this.
> lrwxrwxrwx    1         0 Oct 20 14:52 1:0:0:0 -> 
> ../../../devices/platform/xhci-hcd/usb1/1-2/1-2:1.0/host1/target1:0:0/1:0:0:0
> <lsscsi.patch>
> 
> //Markus - The panama-hat hacker
> 
> _______________________________________________
> busybox mailing list
> [email protected]
> http://lists.busybox.net/mailman/listinfo/busybox

//Markus - The panama-hat hacker

Attachment: signature.asc
Description: Message signed with OpenPGP using GPGMail

_______________________________________________
busybox mailing list
[email protected]
http://lists.busybox.net/mailman/listinfo/busybox

Reply via email to