public inbox for stgt@vger.kernel.org
 help / color / mirror / Atom feed
* [tgt] [PATCH] Fix shmat() wrong return value test method
@ 2014-07-08 11:54 Dongliang Ma
  0 siblings, 0 replies; 2+ messages in thread
From: Dongliang Ma @ 2014-07-08 11:54 UTC (permalink / raw)
  To: stgt

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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread
* [tgt] [PATCH] Fix shmat() wrong return value test method
@ 2014-07-08 10:07 Dongliang Ma
  0 siblings, 0 replies; 2+ messages in thread
From: Dongliang Ma @ 2014-07-08 10:07 UTC (permalink / raw)
  To: stgt

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);

^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-07-08 11:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-07-08 11:54 [tgt] [PATCH] Fix shmat() wrong return value test method Dongliang Ma
  -- strict thread matches above, loose matches on Subject: below --
2014-07-08 10:07 Dongliang Ma

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox