[canopy-httpd] r1106 committed - use exit codes from sysexits.h

1 view
Skip to first unread message

codesite...@google.com

unread,
Dec 2, 2010, 9:05:11 PM12/2/10
to canopy-s...@googlegroups.com
Revision: 1106
Author: phrakt
Date: Thu Dec 2 18:04:32 2010
Log: use exit codes from sysexits.h

http://code.google.com/p/canopy-httpd/source/detail?r=1106

Modified:
/trunk/src/sbin/canopyctl/canopyctl.c

=======================================
--- /trunk/src/sbin/canopyctl/canopyctl.c Mon Aug 31 19:45:42 2009
+++ /trunk/src/sbin/canopyctl/canopyctl.c Thu Dec 2 18:04:32 2010
@@ -45,6 +45,7 @@

#include <canopy/log.h>
#include <canopy/string.h>
+#include <canopy/sysexits.h>

#include <httpd/ctl.h>

@@ -138,11 +139,12 @@
euid = geteuid();

if ((pw = getpwuid(euid)) == NULL)
- err(1, "failed to lookup password entry for current user");
+ err(EX_NOUSER, "failed to get password entry for current user");

strlcpy(username, pw->pw_name, sizeof(username));

- gethostname(hostname, sizeof(hostname));
+ if (gethostname(hostname, sizeof(hostname)) == -1)
+ err(EX_NOHOST, "failed to lookup hostname");

/* parse options */
while ((ch = getopt(argc, argv, "dhs:Vv")) != -1) {
@@ -153,7 +155,7 @@
break;
case 'h':
usage();
- exit(0);
+ exit(EX_OK);

break; /* NOTREACHED */

@@ -164,14 +166,14 @@
case 'V':
fprintf(stdout, "%s version 0.1\n",
__progname);
- exit(0);
+ exit(EX_OK);

break; /* NOTREACHED */
case 'v':
break;
default:
usage();
- exit(1);
+ exit(EX_USAGE);

break; /* NOTREACHED */
}
@@ -190,7 +192,7 @@
}
else {
if (canopyctl_sh_init(&env) == -1)
- errx(1, "failed to initialize shell environment");
+ errx(EX_SOFTWARE, "failed to initialize shell");

canopyctl_sh_loop(&env);

@@ -199,7 +201,7 @@

cnp_log_close(canopyctl_logchan);

- return (0);
+ return (EX_OK);
}

/*

Reply all
Reply to author
Forward
0 new messages