name = node_name(parent);
packet = packet_create_noack("pkg_ctrl", "sss", "rminst", name, inst->id);
+ if (!packet) {
+ printf("Failed to create a packet\n");
+ return;
+ }
+
com_core_packet_send_only(s_info.fd, packet);
packet_destroy(packet);
s_info.cmd = INST_CTRL;
case ROOT:
printf("Not supported yet\n");
break;
- default:
- printf("Invalid type\n");
- return -EFAULT;
}
return 0;
int idx;
idx = 0;
- while (idx < sizeof(command) && *cmd && *cmd != ' ')
+ while (idx < (sizeof(command) - 1) && *cmd && *cmd != ' ')
command[idx++] = *cmd++;
command[idx] = '\0';
if (!y)
y = &_y;
- if (!XGetGeometry(disp, id, &dummy_win, x, y, w, h, &dummy_border, &dummy_depth)) {
+ if (!XGetGeometry(disp, id, &dummy_win, x, y, w, h, &dummy_border, &dummy_depth))
return -EFAULT;
- }
return 0;
}
XShmGetImage(disp, id, xim, 0, 0, 0xFFFFFFFF);
XSync(disp, False);
- fd = open(filename, O_CREAT | O_RDWR);
- if (fd > 0) {
+ fd = open(filename, O_CREAT | O_RDWR, 0644);
+ if (fd >= 0) {
if (write(fd, xim->data, bufsz) != bufsz)
printf("Data is not fully written\n");