- if(BC_WindowBase::get_resources()->use_vframe_shm() && use_shm)
- {
- new_shmid = shmget(IPC_PRIVATE,
- bytes,
- IPC_CREAT | 0777);
- new_data = (unsigned char*)shmat(new_shmid, NULL, 0);
+ if( BC_WindowBase::get_resources()->use_vframe_shm() && use_shm ) {
+ new_shmid = shmget(IPC_PRIVATE, bytes, IPC_CREAT | 0777);
+ if( new_shmid >= 0 ) {
+ new_data = (unsigned char *) shmat(new_shmid, NULL, 0);
+ if( new_data == (unsigned char *)-1 ) new_data = 0;
+ }
+ if( !new_data ) {
+ printf("VFrame::allocate_compressed_data %d could not allocate"
+ " shared memory, %ld\n", __LINE__, bytes);
+ BC_Trace::dump_shm_stats(stdout);
+ exit(1);
+ }