Author: jsuchome Date: Mon Mar 3 16:44:47 2008 New Revision: 45165 URL: http://svn.opensuse.org/viewcvs/yast?rev=45165&view=rev Log: - fixed handling of child process exit (#361638) - 2.13.3 Modified: branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/VERSION branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp Modified: branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/VERSION URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/VERSION?rev=45165&r1=45164&r2=45165&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/VERSION (original) +++ branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/VERSION Mon Mar 3 16:44:47 2008 @@ -1 +1 @@ -2.13.2 +2.13.3 Modified: branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc?rev=45165&r1=45164&r2=45165&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc (original) +++ branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.cc Mon Mar 3 16:44:47 2008 @@ -38,6 +38,7 @@ ThinkFingerAgent::ThinkFingerAgent() : SCRAgent() { child_pid = -1; + child_retval = -1; } /** @@ -156,7 +157,7 @@ } else if (PC(0) == "state") { YCPMap retmap; - if (!child_pid) + if (child_pid == -1) { y2error ("ThinkFinger not initialized yet!"); return ret; @@ -178,19 +179,49 @@ } retmap->add (YCPString ("state"), YCPInteger (state)); } + else if (retval == 0) + { + // check if child is still alive + int status; + if (waitpid (-1, &status, WNOHANG) != 0) + { + if (WIFSIGNALED (status)) + { + y2error ("child process was killed"); + child_pid = -1; + return ret; + } + if (WIFEXITED (status)) + { + child_retval = WEXITSTATUS (status); + child_pid = -1; + return ret; + } + } + } return retmap; } // wait for child exit else if (PC(0) == "exit_status" ) { int status; int retval = 255; - wait (&status); - if (WIFSIGNALED (status)) - y2milestone ("child process was killed"); - else if (WIFEXITED (status)) + if (child_pid != -1) + { + wait (&status); + if (WIFSIGNALED (status)) + y2milestone ("child process was killed"); + else if (WIFEXITED (status)) + { + retval = WEXITSTATUS (status); + y2milestone ("retval is %d", retval); + } + } + else { - retval = WEXITSTATUS (status); - y2milestone ("retval is %d", retval); + y2milestone ("child process already dead"); + if (child_retval) + retval = child_retval; + child_retval = -1; } ret = YCPInteger (retval); close (data_pipe[0]); // close FD for reading @@ -237,6 +268,7 @@ { y2milestone ("... still alive, killing it", child_pid); kill (child_pid, 9); + wait (&status); } child_pid = -1; } Modified: branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h?rev=45165&r1=45164&r2=45165&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h (original) +++ branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/agent-thinkfinger/src/ThinkFingerAgent.h Mon Mar 3 16:44:47 2008 @@ -102,7 +102,6 @@ */ virtual YCPValue otherCommand(const YCPTerm& term); - /** * array with pipe file descriptors */ @@ -113,6 +112,11 @@ */ pid_t child_pid; + /** + * return value of the child process + */ + int child_retval; + }; #endif /* _ThinkFingerAgent_h */ Modified: branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes?rev=45165&r1=45164&r2=45165&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes (original) +++ branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/package/yast2-fingerprint-reader.changes Mon Mar 3 16:44:47 2008 @@ -1,4 +1,10 @@ ------------------------------------------------------------------- +Fri Feb 29 13:08:29 CET 2008 - jsuchome@suse.cz + +- fixed handling of child process exit (#361638) +- 2.13.3 + +------------------------------------------------------------------- Thu Feb 14 10:09:42 CET 2008 - jsuchome@suse.cz - added modalias to Supplements, so package could get selected Modified: branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp URL: http://svn.opensuse.org/viewcvs/yast/branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp?rev=45165&r1=45164&r2=45165&view=diff ============================================================================== --- branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp (original) +++ branches/SuSE-SLE-10-SP2-Branch/fingerprint-reader/src/users_plugin_fingerprint_reader.ycp Mon Mar 3 16:44:47 2008 @@ -170,7 +170,8 @@ if (ui == `cancel || ui == `back) { SCR::Execute (.thinkfinger.cancel); - y2milestone ("exit status after cancel: %1", SCR::Read (.thinkfinger.exit_status)); + y2milestone ("canceled"); +// y2milestone ("exit status after cancel: %1", SCR::Read (.thinkfinger.exit_status)); wait after cancel will be called in the cancel call break; } sleep (100); -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org