[PATCH] minor correctness fix to the Documentation/rtc.txt example program.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

When compiling the example program from Documentation/rtc.txt there is a 
tiny compiler warning about main() not returning int. That is no big 
deal, but for the sake of correctness (and since main actually does 
return a value on error) I have made a small patch to fix it (see below, 
patch also attached as 'rtc.txt-patch').

The patch is pretty self explaining. It changes the return type of main 
to int and adds a call to exit(0) at the end of main(), so now we have 
killed the warning and return a meaningfull value on sucessfull completion.

The patch is against vanilla 2.4.3 and applies cleanly and the program 
in rtc.txt compiles and runs without a problem after applying the patch.

I hope you like the patch and will apply it (comments and criticism is 
welcome) :-)


-----[ Start of patch ]-----

--- linux-2.4.3-vanilla/Documentation/rtc.txt   Sun Apr 22 02:33:10 2001
+++ linux-2.4.3/Documentation/rtc.txt   Sun Apr 22 02:39:55 2001
@@ -89,7 +89,7 @@
  #include <unistd.h>
  #include <errno.h>

-void main(void) {
+int main(void) {

  int i, fd, retval, irqcount = 0;
  unsigned long tmp, data;
@@ -277,5 +277,6 @@
                                                                  irqcount);

  close(fd);
+exit(0);

  } /* end main */

-----[ End of patch ]-----


Best regards,
Jesper Juhl - juhl@eisenstein.dk
--- linux-2.4.3-vanilla/Documentation/rtc.txt	Sun Apr 22 02:33:10 2001
+++ linux-2.4.3/Documentation/rtc.txt	Sun Apr 22 02:39:55 2001
@@ -89,7 +89,7 @@
 #include <unistd.h>
 #include <errno.h>
 
-void main(void) {
+int main(void) {
 
 int i, fd, retval, irqcount = 0;
 unsigned long tmp, data;
@@ -277,5 +277,6 @@
 								 irqcount);
 
 close(fd);
+exit(0);
 
 } /* end main */

[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux 802.1Q VLAN]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Git]     [Bugtraq]     [Yosemite News and Information]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux PCI]     [Linux Admin]     [Samba]

  Powered by Linux