From d0dcc1a584f46ae411b5a72d1b308d9964a829b7 Mon Sep 17 00:00:00 2001 From: Vladislav Bolkhovitin Date: Mon, 24 Dec 2007 10:20:18 +0000 Subject: [PATCH] Patches from Arne Redlich : 1. The kernel's log level is a string, so strcmp needs to be used for comparisons. 2. Svn HEAD doesn't compile against kernel versions < 2.6.19 because "bool" had its debut only in 2.6.19. Here's a quick fix. 3. Iscsi-scstd dies with SIGPIPE if run in foreground mode because the reading end of the init_report_pipe is already closed in this mode. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@238 d57e44dd-8a1f-0410-8b47-8ef2f437770f --- iscsi-scst/usr/iscsi_scstd.c | 5 ++++- scst/include/scsi_tgt.h | 4 ++++ scst/include/scst_debug.h | 4 ++-- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/iscsi-scst/usr/iscsi_scstd.c b/iscsi-scst/usr/iscsi_scstd.c index d9bacdbcc..2ff27476b 100644 --- a/iscsi-scst/usr/iscsi_scstd.c +++ b/iscsi-scst/usr/iscsi_scstd.c @@ -454,7 +454,10 @@ static void event_loop(int timeout) close(init_report_pipe[0]); res = 0; - write(init_report_pipe[1], &res, sizeof(res)); + + if (log_daemon) + write(init_report_pipe[1], &res, sizeof(res)); + close(init_report_pipe[1]); while (1) { diff --git a/scst/include/scsi_tgt.h b/scst/include/scsi_tgt.h index 4f25a7e03..58e9f4ca4 100644 --- a/scst/include/scsi_tgt.h +++ b/scst/include/scsi_tgt.h @@ -36,6 +36,10 @@ #include +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,19) +typedef _Bool bool; +#endif + /* Version numbers, the same as for the kernel */ #define SCST_VERSION_CODE 0x000906 #define SCST_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c)) diff --git a/scst/include/scst_debug.h b/scst/include/scst_debug.h index 995dae1b4..037d43dd4 100644 --- a/scst/include/scst_debug.h +++ b/scst/include/scst_debug.h @@ -282,7 +282,7 @@ do { \ #define PRINT_ERROR(format, args...) \ do { \ - if (ERROR_FLAG != LOG_FLAG) \ + if (strcmp(ERROR_FLAG, LOG_FLAG)) \ { \ PRINT_LOG_FLAG(LOG_FLAG, "***ERROR*** " format, args); \ } \ @@ -291,7 +291,7 @@ do { \ #define PRINT_INFO(format, args...) \ do { \ - if (INFO_FLAG != LOG_FLAG) \ + if (strcmp(INFO_FLAG, LOG_FLAG)) \ { \ PRINT_LOG_FLAG(LOG_FLAG, format, args); \ } \