extra pkg install: added rpm file contraint
authorJinhyung Choi <jinhyung2.choi@samsung.com>
Thu, 16 Apr 2015 07:00:09 +0000 (16:00 +0900)
committerJinhyung Choi <jinhyung2.choi@samsung.com>
Thu, 16 Apr 2015 07:09:43 +0000 (16:09 +0900)
1. the file length should be longer than 4 because of .rpm
2. last 4 chars must be ".rpm"

Change-Id: I63bce04b16d46116bd4ae9c626232e2d4d3cf130
Signed-off-by: Jinhyung Choi <jinhyung2.choi@samsung.com>
tizen/src/util/extra_pkgs_install.c
tizen/src/util/extra_pkgs_install.h

index 8b6923c..6da18d7 100644 (file)
@@ -124,6 +124,7 @@ void epi_init(void)
     struct dirent *sub_dir_entry = NULL;
     char addon[MAX_PATH_PKG_LIST];
     char pkgs[MAX_PKG_LIST];
+    char *ext;
     char* addon_path = get_addon_path();
 
     if (!addon_path) {
@@ -160,6 +161,13 @@ void epi_init(void)
             while((sub_dir_entry = readdir(sub_dir))) {
                 if ((strncasecmp(sub_dir_entry->d_name ,".", 1) != 0) &&
                     (strncasecmp(sub_dir_entry->d_name ,"..", 2) != 0)) {
+                    if (strlen(sub_dir_entry->d_name) <= 4)
+                        continue;
+
+                    ext = &sub_dir_entry->d_name[strlen(sub_dir_entry->d_name) - 4];
+                    if (strcmp(EXT_RPM, ext))
+                            continue;
+
                     pkg_count++;
                     add_addon_pkgs_name(pkgs, sub_dir_entry->d_name);
                     LOG_TRACE("reading addon sub directory: %s\n", sub_dir_entry->d_name);
index 7000ae6..8b02e4b 100644 (file)
@@ -35,6 +35,8 @@
 #define IMAGE_DIRECTORY     "emulator-images"
 #define ADDON_DIRECTORY     "add-ons"
 
+#define EXT_RPM             ".rpm"
+
 #define CMD_PKG             "package"
 
 #define MAX_PKG_LIST        1024