- if (mode == ATTACH_RW)
- return shmat(id, NULL, 0);
- return shmat(id, NULL, SHM_RDONLY);
+ if (mode == ATTACH_RW) {
+ *result = shmat(id, NULL, 0);
+ return *result? 1 : -E_SHM_ATTACH;
+ }
+ *result = shmat(id, NULL, SHM_RDONLY);
+ return *result? 1 : -E_SHM_ATTACH;