udev = udev_new();
if (!udev) {
_E("error create udev");
- return -1;
+ return -EINVAL;
}
mon = udev_monitor_new_from_netlink(udev, "kernel");
if (mon == NULL) {
_E("error udev_monitor create");
uevent_control_stop(-1);
- return -1;
+ return -EINVAL;
+ }
+
+ if (udev_monitor_set_receive_buffer_size(mon, 1024) != 0) {
+ _E("fail to set receive buffer size");
+ return -EINVAL;
}
- udev_monitor_set_receive_buffer_size(mon, 1024);
+ _D("success to set receive buffer size");
if (udev_monitor_filter_add_match_subsystem_devtype(mon, "platform", NULL) < 0 ||
udev_monitor_filter_add_match_subsystem_devtype(mon, "input", NULL) < 0) {
_E("error apply subsystem filter");
if (ufd == -1) {
_E("error udev_monitor_get_fd");
uevent_control_stop(ufd);
- return -1;
+ return -EINVAL;
}
ufdh = ecore_main_fd_handler_add(ufd, ECORE_FD_READ, uevent_control_cb, NULL, NULL, NULL);
if (!ufdh) {
_E("error ecore_main_fd_handler_add");
uevent_control_stop(ufd);
- return -1;
+ return -EINVAL;
}
if (udev_monitor_enable_receiving(mon) < 0) {
_E("error unable to subscribe to udev events");
uevent_control_stop(ufd);
- return -1;
+ return -EINVAL;
}
return 0;
static int present_status = 1;
bundle *b;
- bundle_add(b, "_SYSPOPUP_CONTENT_", "battdisconnect");
-
- ret = syspopup_launch("lowbat-syspopup", b);
+ b = bundle_create();
+ if (!b) {
+ _E("fail to create bundle");
+ return -EINVAL;
+ }
- if (ret < 0) {
- _E("popup launch failed");
+ ret = bundle_add(b, "_SYSPOPUP_CONTENT_", "battdisconnect");
+ if (ret != 0) {
+ _E("fail to add bundle");
+ goto out;
}
+ ret = syspopup_launch("lowbat-syspopup", b);
+ if (ret < 0)
+ _E("popup launch failed");
+
+out:
bundle_free(b);
+ return ret;
}
static void pci_keyboard_add_cb(struct ss_main_data *ad)
ss_action_entry_add_internal(PREDEF_BATTERY_CF_OPENED, battery_def_cf_opened_actioin, NULL, NULL);
ss_action_entry_add_internal(PREDEF_DEVICE_CHANGED, changed_device_def_predefine_action, NULL, NULL);
- if (uevent_control_start() == -1) {
+ if (uevent_control_start() != 0) {
_E("fail uevent control init");
return;
}
return -EINVAL;
}
/* check fs type with magic code */
- lseek(fd, fs_ext4_type.offset, SEEK_SET);
+ ret = lseek(fd, fs_ext4_type.offset, SEEK_SET);
+ if (ret != 0) {
+ _E("fail to check offset of ext4");
+ goto out;
+ }
ret = read(fd, buf, 2);
_D("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]);
if (!memcmp(buf, fs_ext4_type.magic, fs_ext4_type.magic_sz)) {
return fs_ext4_type.type;
}
+out:
close(fd);
return -EINVAL;
}
return -EINVAL;
}
/* check fs type with magic code */
- lseek(fd, fs_vfat_type.offset, SEEK_SET);
+ ret = lseek(fd, fs_vfat_type.offset, SEEK_SET);
+ if (ret != 0) {
+ _E("fail to check offset of vfat");
+ goto out;
+ }
ret = read(fd, buf, 2);
_D("mmc search magic : 0x%2x, 0x%2x", buf[0],buf[1]);
if (!memcmp(buf, fs_vfat_type.magic, fs_vfat_type.magic_sz)) {
close(fd);
return fs_vfat_type.type;
}
+out:
close(fd);
return -EINVAL;
}