libusb icon indicating copy to clipboard operation
libusb copied to clipboard

xusb: Define proper exit status

Open RinHizakura opened this issue 1 year ago • 4 comments

Can we consider to propagate the return value from test_device() to main()? In this way, we can easily check the return code directly like echo $? in Linux to know whether the test is failed.

RinHizakura avatar Jun 03 '24 16:06 RinHizakura

I'd also change the test_device to return 0/1 (instead of -1), or even EXIT_SUCCESS/EXIT_FAILURE named constants. Negative exit code usually means exit by interruption.

Youw avatar Jun 03 '24 16:06 Youw

Yes, a proper exit status would be a good improvement. In general I'd suggest letting internal functions return and propagate libusb error codes, but then in main(), also on line 1216, something like if (r<0) return EXIT_FAILURE.

tormodvolden avatar Jun 03 '24 17:06 tormodvolden

That sounds even better

Youw avatar Jun 03 '24 18:06 Youw

I make a change according to the comment, but please let me know if this is what you want. Thanks!

RinHizakura avatar Jun 04 '24 12:06 RinHizakura

Thanks for your contribution!

tormodvolden avatar Jul 28 '24 11:07 tormodvolden