From 225a939a00490c2e6f45cd068abd514c96dde50e Mon Sep 17 00:00:00 2001 From: iovar Date: Mon, 19 Feb 2007 06:42:08 +0000 Subject: added check so program will exit before the attach, when it fails to obtain the shared memory git-svn-id: https://recordmydesktop.svn.sourceforge.net/svnroot/recordmydesktop/trunk@284 f606c939-3180-4ac9-a4b8-4b8779d57d0a --- recordmydesktop/src/initialize_data.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'recordmydesktop') diff --git a/recordmydesktop/src/initialize_data.c b/recordmydesktop/src/initialize_data.c index c65fcf1..8223f19 100644 --- a/recordmydesktop/src/initialize_data.c +++ b/recordmydesktop/src/initialize_data.c @@ -121,10 +121,14 @@ int InitializeData(ProgData *pdata, &pdata->shminfo, pdata->brwin.rgeom.width, pdata->brwin.rgeom.height); - pdata->shminfo.shmid=shmget (IPC_PRIVATE, - pdata->shimage->bytes_per_line* - pdata->shimage->height, - IPC_CREAT|0777); + pdata->shminfo.shmid=shmget(IPC_PRIVATE, + pdata->shimage->bytes_per_line* + pdata->shimage->height, + IPC_CREAT|0777); + if(shminfo->shmid==-1){ + fprintf(stderr,"Failed to obtain Shared Memory segment!\n"); + return 12; + } pdata->shminfo.shmaddr=pdata->shimage->data=shmat(pdata->shminfo.shmid, NULL,0); pdata->shminfo.readOnly = False; -- cgit v1.2.3