X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=b6c2de2788a131f446f48893717a826ea3fd8845;hp=4eab9f65348990e5f4f95568623f032376a43b4e;hb=3dca24604449f268274e8458fbd5447e55dd7cc8;hpb=190eec54bed8fe79e0ccd72614b253d591e76b4f diff --git a/command.c b/command.c index 4eab9f65..b6c2de27 100644 --- a/command.c +++ b/command.c @@ -660,12 +660,10 @@ out: } /** - * perform user authentication and execute a command + * Perform user authentication and execute a command. * - * \param fd The file descriptor to send output to - * \param peername Identifies the connecting peer. - * - * \return EXIT_SUCCESS or EXIT_FAILURE + * \param fd The file descriptor to send output to. + * \param peername Identifies the connecting peer. * * Whenever para_server accepts an incoming tcp connection on * the port it listens on, it forks and the resulting child @@ -688,7 +686,7 @@ out: * * \sa alarm(2), rc4(3), crypt.c, crypt.h */ -int handle_connect(int fd, const char *peername) +__noreturn void handle_connect(int fd, const char *peername) { int ret, argc, use_rc4 = 0; char buf[4096]; @@ -799,15 +797,12 @@ int handle_connect(int fd, const char *peername) PARA_NOTICE_LOG("calling com_%s() for %s@%s\n", cmd->name, u->name, peername); ret = cmd->handler(fd, argc, argv); - if (ret >= 0) { - ret = EXIT_SUCCESS; + if (ret >= 0) goto out; - } err_out: send_va_buffer(fd, "%s\n", para_strerror(-ret)); net_err: PARA_NOTICE_LOG("%s\n", para_strerror(-ret)); - ret = EXIT_FAILURE; out: free(command); free(argv); @@ -816,5 +811,5 @@ out: mmd->events++; mmd->active_connections--; mmd_unlock(); - return ret; + exit(ret < 0? EXIT_FAILURE : EXIT_SUCCESS); }