Fix shmat() wrong return value test method
PATCH 1/1 Fix shmat() wrong return value test method
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(-)
---
usr/log.c +3 -3
@@ -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);