From: <vl...@us...> - 2007-10-25 16:20:03
|
Revision: 212 http://scst.svn.sourceforge.net/scst/?rev=212&view=rev Author: vlnb Date: 2007-10-25 09:19:40 -0700 (Thu, 25 Oct 2007) Log Message: ----------- - Fixed ignoring errors on the service start. Reported by Tomasz Chmielewski <ma...@wp...> - Minor fixes Modified Paths: -------------- trunk/iscsi-scst/usr/iscsi_scstd.c trunk/scst/src/dev_handlers/scst_vdisk.c trunk/scst/src/scst_main.c Modified: trunk/iscsi-scst/usr/iscsi_scstd.c =================================================================== --- trunk/iscsi-scst/usr/iscsi_scstd.c 2007-10-25 10:46:29 UTC (rev 211) +++ trunk/iscsi-scst/usr/iscsi_scstd.c 2007-10-25 16:19:40 UTC (rev 212) @@ -80,6 +80,8 @@ /* This will be comfigurable by command line options */ struct config_operations *cops = &plain_ops; +int init_report_pipe[2]; + static void usage(int status) { if (status != 0) @@ -149,38 +151,40 @@ hints.ai_flags = AI_PASSIVE; if (getaddrinfo(server_address, servname, &hints, &res0)) { - log_error("unable to get address info (%s)!", strerror(errno)); + log_error("Unable to get address info (%s)!", strerror(errno)); exit(1); } for (i = 0, res = res0; res && i < LISTEN_MAX; i++, res = res->ai_next) { sock = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (sock < 0) { - log_error("unable to create server socket (%s) %d %d %d!", + log_error("Unable to create server socket (%s) %d %d %d!", strerror(errno), res->ai_family, res->ai_socktype, res->ai_protocol); - continue; + exit(1); } sock_set_keepalive(sock, 50); opt = 1; if (setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt))) - log_warning("unable to set SO_REUSEADDR on server socket (%s)!", + log_warning("Unable to set SO_REUSEADDR on server socket (%s)!", strerror(errno)); opt = 1; if (res->ai_family == AF_INET6 && - setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt))) - continue; + setsockopt(sock, IPPROTO_IPV6, IPV6_V6ONLY, &opt, sizeof(opt))) { + log_error("Unable to restrict IPv6 socket (%s)", strerror(errno)); + exit(1); + } if (bind(sock, res->ai_addr, res->ai_addrlen)) { - log_error("unable to bind server socket (%s)!", strerror(errno)); - continue; + log_error("Unable to bind server socket (%s)!", strerror(errno)); + exit(1); } if (listen(sock, INCOMING_MAX)) { - log_error("unable to listen to server socket (%s)!", strerror(errno)); - continue; + log_error("Unable to listen to server socket (%s)!", strerror(errno)); + exit(1); } set_non_blocking(sock); @@ -439,6 +443,11 @@ incoming[i] = NULL; } + close(init_report_pipe[0]); + res = 0; + write(init_report_pipe[1], &res, sizeof(res)); + close(init_report_pipe[1]); + while (1) { res = poll(poll_array, POLL_MAX, timeout); if (res == 0) { @@ -506,6 +515,11 @@ char *isns = NULL; int isns_ac = 0; + if (pipe(init_report_pipe) == -1) { + perror("pipe"); + exit(-1); + } + while ((ch = getopt_long(argc, argv, "c:fd:s:u:g:a:p:vh", long_options, &longindex)) >= 0) { switch (ch) { case 'c': @@ -572,8 +586,14 @@ if (pid < 0) { log_error("starting daemon failed"); exit(1); - } else if (pid) - exit(0); + } else if (pid) { + int res = -1; + close(init_report_pipe[1]); + if (read(init_report_pipe[0], &res, sizeof(res)) < sizeof(res)) + exit(-1); + else + exit(res); + } chdir("/"); if (lockf(fd, F_TLOCK, 0) < 0) { Modified: trunk/scst/src/dev_handlers/scst_vdisk.c =================================================================== --- trunk/scst/src/dev_handlers/scst_vdisk.c 2007-10-25 10:46:29 UTC (rev 211) +++ trunk/scst/src/dev_handlers/scst_vdisk.c 2007-10-25 16:19:40 UTC (rev 212) @@ -37,6 +37,7 @@ #include <linux/vmalloc.h> #include <asm/atomic.h> #include <linux/kthread.h> +#include <linux/sched.h> #define LOG_PREFIX "dev_vdisk" Modified: trunk/scst/src/scst_main.c =================================================================== --- trunk/scst/src/scst_main.c 2007-10-25 10:46:29 UTC (rev 211) +++ trunk/scst/src/scst_main.c 2007-10-25 16:19:40 UTC (rev 212) @@ -139,7 +139,7 @@ struct scst_dev_type scst_null_devtype = { - name: "null_handler", + name: "none", }; int scst_register_target_template(struct scst_tgt_template *vtt) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |