Browse Source

Merge pull request #1352 from martin-frbg/issue1351

Output an error message when shmat() fails
tags/v0.3.0
Martin Kroeker GitHub 8 years ago
parent
commit
cc26cdce0c
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      driver/others/init.c

+ 5
- 2
driver/others/init.c View File

@@ -78,6 +78,8 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

#include <sys/sysinfo.h>
#include <sys/syscall.h>
#include <sys/types.h>
#include <errno.h>
#include <sys/shm.h>
#include <fcntl.h>
#include <sched.h>
@@ -659,8 +661,9 @@ static void open_shmem(void) {
exit(1);
}

if (shmid != -1) common = (shm_t *)shmat(shmid, NULL, 0);

if (shmid != -1) {
if ( (common = shmat(shmid, NULL, 0)) == (void*)-1) perror ("Attaching shared memory segment");
}
#ifdef DEBUG
fprintf(stderr, "Shared Memory id = %x Address = %p\n", shmid, common);
#endif


Loading…
Cancel
Save