Review Request 113779: KInfocenter/OpenGL: fix ReadPipe() in the case that the command cannot be run

Wolfgang Bauer wbauer at tmo.at
Mon Nov 11 11:31:54 GMT 2013


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
http://git.reviewboard.kde.org/r/113779/
-----------------------------------------------------------

(Updated Nov. 11, 2013, 11:31 a.m.)


Status
------

This change has been marked as submitted.


Review request for kde-workspace and David Stephen Hubner.


Bugs: 327382
    http://bugs.kde.org/show_bug.cgi?id=327382


Repository: kde-workspace


Description
-------

ReadPipe() doesn't return 0 as expected in the case that the command is not found. but the length of sh's output which is "command not found" in this case. This is because popen() does not fail if the command is not found, because it _can_ run "sh". (according to the man page, popen calls "/bin/sh -c command")
To fix this, ReadPipe() should check the return code of the call to pclose() (see "man pclose"), and return 0 if this is not equal to 0.


Diffs
-----

  kinfocenter/Modules/opengl/opengl.cpp 7df2b17 

Diff: http://git.reviewboard.kde.org/r/113779/diff/


Testing
-------

Run KInfocenter on openSUSE, where lspci is in /sbin and that is not in the user's path.
Without this patch, 3D Accelerator will be shown as "unknown" (because lspci cannot be run, with this patch it works as intended.
I also tried with lspci in /usr/bin/ (i.e. in the path) and completely removed, worked as expected (correct information in the former case, "unknown" in the latter).


Thanks,

Wolfgang Bauer

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20131111/b47756c0/attachment.htm>


More information about the kde-core-devel mailing list