Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 26 May 2008 20:14:38 +0300
From:      Krassimir Slavchev <krassi@bulinfo.net>
To:        FreeBSD <freebsd-stable@freebsd.org>
Subject:   shmat() return values?
Message-ID:  <483AEFFE.8080302@bulinfo.net>

next in thread | raw e-mail | index | archive | help
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hello,

When I try:

if ((*shm = shmat(shmid, NULL, 0)) == -1)

The gcc complains with:
warning: comparison between pointer and integer

shmat() is declared in shm.h as:
void *shmat(int, const void *, int);

but 'man 4 shmat;

RETURN VALUES
     Upon success, shmat() returns the address where the segment is
attached;
     otherwise, -1 is returned and errno is set to indicate the error.


What is the correct return value on failure, -1 or NULL?
I think it should be NULL?

Best Regards
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQFIOu/+xJBWvpalMpkRAjZUAJ9UWQhOaUw/xtoNTfMydiudWv7apwCaAomp
gJhTr9Iwh0jalQL+r8KwKdY=
=m30h
-----END PGP SIGNATURE-----



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?483AEFFE.8080302>