Altre correzioni
authorSimone Piccardi <piccardi@gnulinux.it>
Fri, 22 Apr 2011 00:15:29 +0000 (00:15 +0000)
committerSimone Piccardi <piccardi@gnulinux.it>
Fri, 22 Apr 2011 00:15:29 +0000 (00:15 +0000)
sources/test_signalfd.c

index cfdcd0b9d680f5394eccae0e32bff02976f4d74f..48a0935dc9e4730c5f63bbee2307a2f8618f2450 100644 (file)
@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
 /* 
  * Variables definition  
  */
-    int i, nomask=0, testwrite=0, sigfd;
+    int i, n, nomask=0, testwrite=0, sigfd;
     time_t t;
     struct signalfd_siginfo siginf;
     sigset_t sigmask;
@@ -104,9 +104,10 @@ int main(int argc, char *argv[])
        die("Failing in signalfd");
     printf("Signalfd armed\n");
     if (testwrite) {
-       if (write(sigfd, buffer, sizeof(buffer)))
+       if ( (n=write(sigfd, buffer, sizeof(buffer))) < 0)
            perror("write on signal fd error");
-       else printf("write successfully\n");        
+       else
+           printf("write successfully %d bytes\n", n);     
     }
     /* raise signal */
     if (raise(SIGINT) != 0)