Bug 61421 - Wrong usage of sigaction in dhcpcd
Summary: Wrong usage of sigaction in dhcpcd
Keywords:
Status: CLOSED WONTFIX
Alias: None
Product: Red Hat Linux
Classification: Retired
Component: dhcpcd
Version: 7.2
Hardware: i686
OS: Linux
medium
low
Target Milestone: ---
Assignee: Elliot Lee
QA Contact:
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2002-03-19 14:27 UTC by mehdi.farhat
Modified: 2008-05-01 15:38 UTC (History)
0 users

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2002-03-19 14:28:01 UTC
Embargoed:


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

Description mehdi.farhat 2002-03-19 14:27:56 UTC
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 15:37:22 UTC
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 12:40:59 UTC
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 11:35:48 UTC
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.