bug patch of the prevent alarm issues 12/14912/1
authorgiyeol.ok <giyeol.ok@samsung.com>
Fri, 3 May 2013 05:52:08 +0000 (14:52 +0900)
committerKrzysztof Sasiak <k.sasiak@samsung.com>
Mon, 13 Jan 2014 15:16:10 +0000 (16:16 +0100)
Change-Id: I76513d9e5ceed5b93838f09f98b6066e736a041e
Signed-off-by: giyeol.ok <giyeol.ok@samsung.com>
src/core/device-change-handler.c
src/mmc/ext4.c
src/mmc/vfat.c

index 50f59ed..613905f 100644 (file)
@@ -523,17 +523,22 @@ static int uevent_control_start(void)
        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");
@@ -545,20 +550,20 @@ static int uevent_control_start(void)
        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;
@@ -697,15 +702,25 @@ static int battery_def_cf_opened_actioin(int argc, char **argv)
        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)
@@ -735,7 +750,7 @@ static void device_change_init(void *data)
        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;
        }
index 494090e..624d5a3 100644 (file)
@@ -87,7 +87,11 @@ static int ext4_init(void *data)
                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)) {
@@ -96,6 +100,7 @@ static int ext4_init(void *data)
 
                return fs_ext4_type.type;
        }
+out:
        close(fd);
        return -EINVAL;
 }
index 3038eab..7b43c15 100644 (file)
@@ -52,7 +52,11 @@ static int vfat_init(void *data)
                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)) {
@@ -60,6 +64,7 @@ static int vfat_init(void *data)
                close(fd);
                return fs_vfat_type.type;
        }
+out:
        close(fd);
        return -EINVAL;
 }