Bug 61421 - Wrong usage of sigaction in dhcpcd
Wrong usage of sigaction in dhcpcd
Status: CLOSED WONTFIX
Product: Red Hat Linux
Classification: Retired
Component: dhcpcd (Show other bugs)
7.2
i686 Linux
medium Severity low
: ---
: ---
Assigned To: Elliot Lee
:
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2002-03-19 09:27 EST by mehdi.farhat
Modified: 2008-05-01 11:38 EDT (History)
0 users

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2002-03-19 09:28:01 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)
signals.c.patch for avoid a strange syslog message... (665 bytes, patch)
2002-05-03 07:35 EDT, mehdi.farhat
no flags Details | Diff

  None (edit)
Description mehdi.farhat 2002-03-19 09:27:56 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Description of problem:
in dhcpcd-1.3.18pl8-10 the prog try to make a sigaction on SIGKILL
and report a error on syslog.
like: "dhcpcd[1975]: dhcpConfig: ioctl SIOCADDRT: Invalid argument"

Version-Release number of selected component (if applicable):
dhcpcd-1.3.18pl8-10 

How reproducible:
Always

Steps to Reproduce:
1. just start dhcpcd with some debug
2. strace /sbin/dhcpcd -d -n -H eth0 2>&1 |grep rt_sigaction


Actual Results:  .
.
rt_sigaction(SIGBUS, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGFPE, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGKILL, {0x80494b0, [], 0x4000000}, NULL, 8) = -1 EINVAL 
(Invalid argument)
rt_sigaction(SIGUSR1, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
rt_sigaction(SIGSEGV, {0x80494b0, [], 0x4000000}, NULL, 8) = 0
.
.

Expected Results:  when read the man of sigaction we see:
       signum  specifies  the  signal and can be any valid signal
       except SIGKILL and SIGSTOP.


Additional info:

Just do a report to the dhcpcd maintener.
or just patch the source code for avoid this stupid message.

Have a nice day.
    Mehdi Farhat.
Comment 1 Elliot Lee 2002-04-15 11:37:22 EDT
The slightly broken sigaction usage is not causing the ioctl to fail. (dhcpcd's
signalSetup() function is doing a loop over all the signal numbers from 1
through 15 to set the sigHandler for them. Not great, but forgiveable).
Comment 2 mehdi.farhat 2002-05-02 08:40:59 EDT
Here a sample patch to avoid message in the syslog...

Have a nice day :)
 
____________________
diff -Naur dhcpcd-1.3.22-pl1/signals.c dhcpcd-1.3.22-pl1.new/signals.c
--- dhcpcd-1.3.22-pl1/signals.c	Sun Jan 20 23:51:46 2002
+++ dhcpcd-1.3.22-pl1.new/signals.c	Thu May  2 14:30:03 2002
@@ -129,11 +129,11 @@
 /*****************************************************************************/
 void signalSetup()
 {
-  int i;
+  int signum[]={1,2,3,4,5,6,7,8,10,11,12,13,14,15,17,0};
+  int i=0;
   struct sigaction action;
   sigaction(SIGHUP,NULL,&action);
   action.sa_handler= &sigHandler;
   action.sa_flags = 0;
-  for (i=1;i<16;i++) sigaction(i,&action,NULL);
-  sigaction(SIGCHLD,&action,NULL);
+  while(signum[i]>0){sigaction(signum[i++],&action,NULL);}
 }
Comment 3 mehdi.farhat 2002-05-03 07:35:48 EDT
Created attachment 56285 [details]
signals.c.patch for avoid a strange syslog message...

Note You need to log in before you can comment on or make changes to this bug.