We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents c6968ed + d857682 commit cc26cdcCopy full SHA for cc26cdc
driver/others/init.c
@@ -78,6 +78,8 @@ USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
78
79
#include <sys/sysinfo.h>
80
#include <sys/syscall.h>
81
+#include <sys/types.h>
82
+#include <errno.h>
83
#include <sys/shm.h>
84
#include <fcntl.h>
85
#include <sched.h>
@@ -659,8 +661,9 @@ static void open_shmem(void) {
659
661
exit(1);
660
662
}
663
- if (shmid != -1) common = (shm_t *)shmat(shmid, NULL, 0);
-
664
+ if (shmid != -1) {
665
+ if ( (common = shmat(shmid, NULL, 0)) == (void*)-1) perror ("Attaching shared memory segment");
666
+ }
667
#ifdef DEBUG
668
fprintf(stderr, "Shared Memory id = %x Address = %p\n", shmid, common);
669
#endif
0 commit comments