All of lore.kernel.org
 help / color / mirror / Atom feed
From: Dongliang Ma <mdl13412@gmail.com>
To: stgt@vger.kernel.org
Subject: [tgt] [PATCH] Fix shmat() wrong return value test method
Date: Tue,  8 Jul 2014 18:07:09 +0800 (CST)	[thread overview]
Message-ID: <20140708100709.695A7199A8DB@localhost.localhost> (raw)

From: Dongliang Ma <mdl13412 at gmail.com>

This patch fixed the invalid shmat() return value test method.

Signed-off-by: Dongliang Ma <mdl13412 at gmail.com>
---
usr/log.c |    6 +++---
1 files changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/usr/log.c b/usr/log.c
index 2f0c4d4..24a3af9 100644
--- a/usr/log.c
+++ b/usr/log.c
@@ -61,7 +61,7 @@ static int logarea_init (int size)
 	}
 
 	la = shmat(shmid, NULL, 0);
-	if (!la) {
+	if (la == ((void *) -1)) {
 		syslog(LOG_ERR, "shmat logarea failed %d", errno);
 		return 1;
 	}
@@ -79,7 +79,7 @@ static int logarea_init (int size)
 	}
 
 	la->start = shmat(shmid, NULL, 0);
-	if (!la->start) {
+	if (la->start == ((void *) -1)) {
 		syslog(LOG_ERR, "shmat msg failed %d", errno);
 		shmdt(la);
 		return 1;
@@ -101,7 +101,7 @@ static int logarea_init (int size)
 		return 1;
 	}
 	la->buff = shmat(shmid, NULL, 0);
-	if (!la->buff) {
+	if (la->buff == ((void *) -1)) {
 		syslog(LOG_ERR, "shmat logmsgfailed %d", errno);
 		shmdt(la->start);
 		shmdt(la);

             reply	other threads:[~2014-07-08 10:07 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-08 10:07 Dongliang Ma [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-07-08 11:54 [tgt] [PATCH] Fix shmat() wrong return value test method Dongliang Ma

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=20140708100709.695A7199A8DB@localhost.localhost \
    --to=mdl13412@gmail.com \
    --cc=stgt@vger.kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.