X-Git-Url: https://git.gag.com/?a=blobdiff_plain;f=client-src%2Fnoop.c;h=e9b62706fd152b5a3cec98a22e0f0b40075369cc;hb=410e1914f1e53a812bcbb4601c90b9506f98ace1;hp=3700852b8753991aa9d81145339842dab3dfa440;hpb=1194fb66aa28d9929c3f2bef3cc6c1c3f40a60a4;p=debian%2Famanda diff --git a/client-src/noop.c b/client-src/noop.c index 3700852..e9b6270 100644 --- a/client-src/noop.c +++ b/client-src/noop.c @@ -25,7 +25,7 @@ */ /* - * $Id: noop.c,v 1.3 2006/01/14 04:37:18 paddy_s Exp $ + * $Id: noop.c,v 1.5 2006/06/01 14:54:39 martinea Exp $ * * send back features. This was pulled out to it's own program for * consistancy and because it's a hell of a lot easier to code in @@ -36,22 +36,39 @@ #include "amfeatures.h" #include "util.h" -int main P((int argc, char **argv)); +int main(int argc, char **argv); int -main(argc, argv) - int argc; - char **argv; +main( + int argc, + char ** argv) { char ch; am_feature_t *our_features = NULL; char *our_feature_string = NULL; char *options; - int n; + ssize_t n; + + (void)argc; /* Quiet unused parameter warning */ + (void)argv; /* Quiet unused parameter warning */ + + /* + * Configure program for internationalization: + * 1) Only set the message locale for now. + * 2) Set textdomain for all amanda related programs to "amanda" + * We don't want to be forced to support dozens of message catalogs. + */ + setlocale(LC_MESSAGES, "C"); + textdomain("amanda"); /* Don't die when child closes pipe */ signal(SIGPIPE, SIG_IGN); + safe_fd(-1, 0); + openbsd_fd_inform(); + + check_running_as(RUNNING_AS_CLIENT_LOGIN); + do { /* soak up any stdin */ n = read(0, &ch, 1); @@ -65,9 +82,13 @@ main(argc, argv) amfree(our_feature_string); am_release_feature_set(our_features); our_features = NULL; - if (fullwrite(1, options, strlen(options)) < 0) { - error("error sending noop response: %s", strerror(errno)); + if (full_write(1, options, strlen(options)) < strlen(options)) { + error(_("error sending noop response: %s"), strerror(errno)); + /*NOTREACHED*/ } amfree(options); - exit(0); + close(0); + close(1); + close(2); + return (0); /* exit */ }