diff options
author | Sangyoon Jang <jeremy.jang@samsung.com> | 2020-05-22 15:50:43 +0900 |
---|---|---|
committer | Sangyoon Jang <jeremy.jang@samsung.com> | 2020-05-22 15:50:43 +0900 |
commit | 78bde303bfcfc9393420ce6de5db313ade703432 (patch) | |
tree | 669f608bef0aef3a9f554e50bb1f89b9d9069666 | |
parent | 1af159503d81abaaf64160951f358aa15a844108 (diff) | |
download | slp-pkgmgr-78bde303bfcfc9393420ce6de5db313ade703432.tar.gz slp-pkgmgr-78bde303bfcfc9393420ce6de5db313ade703432.tar.bz2 slp-pkgmgr-78bde303bfcfc9393420ce6de5db313ade703432.zip |
Add path checking at multi pkg install APIs
Change-Id: I3a07d3f9c1b52b8c4ee871d043a7c797abc52d7c
Signed-off-by: Sangyoon Jang <jeremy.jang@samsung.com>
-rw-r--r-- | client/src/pkgmgr.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/client/src/pkgmgr.c b/client/src/pkgmgr.c index e30b3f9..cfbeb09 100644 --- a/client/src/pkgmgr.c +++ b/client/src/pkgmgr.c @@ -400,6 +400,13 @@ API int pkgmgr_client_usr_install_packages(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + for (i = 0; i < n_pkgs; i++) { + if (access(pkg_paths[i], F_OK) != 0) { + ERR("failed to access: %s", pkg_paths[i]); + return PKGMGR_R_EINVAL; + } + } + pkgs_builder = g_variant_builder_new(G_VARIANT_TYPE("as")); for (i = 0; i < n_pkgs; i++) g_variant_builder_add(pkgs_builder, "s", pkg_paths[i]); @@ -635,6 +642,13 @@ API int pkgmgr_client_usr_mount_install_packages(pkgmgr_client *pc, return PKGMGR_R_EINVAL; } + for (i = 0; i < n_pkgs; i++) { + if (access(pkg_paths[i], F_OK) != 0) { + ERR("failed to access: %s", pkg_paths[i]); + return PKGMGR_R_EINVAL; + } + } + pkgs_builder = g_variant_builder_new(G_VARIANT_TYPE("as")); for (i = 0; i < n_pkgs; i++) g_variant_builder_add(pkgs_builder, "s", pkg_paths[i]); |