public inbox for ltp@lists.linux.it
 help / color / mirror / Atom feed
From: Peng Haitao <penght@cn.fujitsu.com>
To: Garrett Cooper <yanegomi@gmail.com>
Cc: ltp-list@lists.sourceforge.net
Subject: [LTP]  [PATCH] syslogtst.c: fix a bug of assert() is used wrong
Date: Thu, 24 Feb 2011 14:17:59 +0800	[thread overview]
Message-ID: <4D65F817.2020904@cn.fujitsu.com> (raw)

Hi Garrett,

When executing "./syslogtst 1", the error message is follows:
syslogtst: syslogtst.c:93: main: Assertion `ch1 != -1' failed.

Signed-off-by: Peng Haitao <penght@cn.fujitsu.com>
---
 testcases/kernel/syscalls/syslog/syslogtst.c |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/testcases/kernel/syscalls/syslog/syslogtst.c b/testcases/kernel/syscalls/syslog/syslogtst.c
index a229688..11a97fd 100644
--- a/testcases/kernel/syscalls/syslog/syslogtst.c
+++ b/testcases/kernel/syscalls/syslog/syslogtst.c
@@ -90,8 +90,6 @@ int main(int argc, char *argv[])
 			ch1 = atoi(argv[2]);
 	}
 
-	assert (ch1 != -1);
-
 	/*
 	 * Send syslog messages according to the case number, which
 	 * we will know from command line.
@@ -101,6 +99,8 @@ int main(int argc, char *argv[])
 		syslog(LOG_MAIL | LOG_INFO, "syslogtst: mail info test.");
 		break;
 	case 2:
+		assert (ch1 != -1);
+
 		switch (ch1) {
 		case 0:
 			syslog(LOG_MAIL | LOG_EMERG,
@@ -254,6 +254,8 @@ int main(int argc, char *argv[])
 		syslog(LOG_USER | LOG_DEBUG, "syslogtst: debug log");
 		break;
 	case 8:
+		assert (ch1 != -1);
+
 		switch (ch1) {
 			/*
 			 * Kernel messages cannot be send by user, so skipping the
@@ -343,4 +345,4 @@ void sig_handler(int signal)
 	}
 
 	exit(signal);
-}
\ No newline at end of file
+}
-- 
1.7.1

-- 
Best Regards,
Peng Haitao


------------------------------------------------------------------------------
Free Software Download: Index, Search & Analyze Logs and other IT data in 
Real-Time with Splunk. Collect, index and harness all the fast moving IT data 
generated by your applications, servers and devices whether physical, virtual
or in the cloud. Deliver compliance at lower cost and gain new business 
insights. http://p.sf.net/sfu/splunk-dev2dev 
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list

             reply	other threads:[~2011-02-24  6:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-24  6:17 Peng Haitao [this message]
2011-02-24  7:32 ` [LTP] [PATCH] syslogtst.c: fix a bug of assert() is used wrong Garrett Cooper
2011-02-24  7:59   ` Peng Haitao
2011-02-24 16:47     ` Garrett Cooper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4D65F817.2020904@cn.fujitsu.com \
    --to=penght@cn.fujitsu.com \
    --cc=ltp-list@lists.sourceforge.net \
    --cc=yanegomi@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox