|
|
On Fri, Jul 25, 2008 at 02:57:10PM -0300, Gleydson Soares wrote:
> - only the superuser can bind to a privileged port through bindresvport().
> - style(9).
after tweaks by thib:
- only needed to fix the output message.
- we're already exiting with err(), remove goto. more cleanup
Index: netdate.c
===================================================================
RCS file: /cvs/src/bin/date/netdate.c,v
retrieving revision 1.16
diff -u -r1.16 netdate.c
--- netdate.c 25 Apr 2006 15:41:07 -0000 1.16
+++ netdate.c 25 Jul 2008 19:13:08 -0000
@@ -103,10 +103,9 @@
memset(&sin, 0, sizeof(sin));
sin.sin_len = sizeof(struct sockaddr_in);
sin.sin_family = AF_INET;
- if (bindresvport(s, &sin) < 0) {
- warnx("all ports in use");
- goto bad;
- }
+ if (bindresvport(s, &sin < 0))
+ err(1,"bindresvpor");
+
msg.tsp_type = TSP_SETDATE;
msg.tsp_vers = TSPVERSION;
if (gethostname(hostname, sizeof(hostname))) {
Index: date.c
===================================================================
RCS file: /cvs/src/bin/date/date.c,v
retrieving revision 1.31
diff -u -r1.31 date.c
--- date.c 28 Dec 2007 19:17:28 -0000 1.31
+++ date.c 25 Jul 2008 19:13:24 -0000
@@ -70,7 +70,7 @@
static void setthetime(char *);
static void badformat(void);
-static void usage(void);
+static __dead void usage(void);
int
main(int argc, char *argv[])
@@ -261,7 +261,7 @@
usage();
}
-static void
+static __dead void
usage(void)
{
(void)fprintf(stderr,
|
|