retvm_if(csc == NULL, PKGMGR_R_EINVAL, "cannot open parse file [%s]", csc_path);
file = fopen(result_path, "w");
- retvm_if(file == NULL, PKGMGR_R_EINVAL, "cannot open result file [%s]", result_path);
+ tryvm_if(file == NULL, ret = PKGMGR_R_EINVAL, "cannot open result file [%s]", result_path);
count = iniparser_getint(csc, "csc packages:count", -1);
- retvm_if(count == 0, PKGMGR_R_ERROR, "csc [%s] dont have packages", csc_path);
+ tryvm_if(count == 0, ret = PKGMGR_R_ERROR, "csc [%s] dont have packages", csc_path);
snprintf(buf, PKG_STRING_LEN_MAX, "[csc %d packages]\n", count);
fwrite(buf, 1, strlen(buf), file);
}
fwrite(buf, 1, strlen(buf), file);
+catch:
iniparser_freedict(csc);
- fflush(file);
- fd = fileno(file);
- fsync(fd);
- fclose(file);
-
+ if (file != NULL) {
+ fflush(file);
+ fd = fileno(file);
+ fsync(fd);
+ fclose(file);
+ }
return ret;
}
switch (service_type) {
case PM_REQUEST_CSC:
- retvm_if(custom_info == NULL, PKGMGR_R_EINVAL, "custom_info is NULL\n");
- retvm_if(data == NULL, PKGMGR_R_EINVAL, "data is NULL\n");
+ tryvm_if(custom_info == NULL, ret = PKGMGR_R_EINVAL, "custom_info is NULL\n");
+ tryvm_if(data == NULL, ret = PKGMGR_R_EINVAL, "data is NULL\n");
ret = __csc_process(custom_info, (char *)data);
if (ret < 0)
break;
}
- return req_id;
+catch:
+ if (req_key)
+ free(req_key);
+
+ return ret;
}
#sbs-git:slp/pkgs/s/slp-pkgmgr pkgmgr 0.1.103 29b53909a5d6e8728429f0a188177eac691cb6ce
Name: pkgmgr
Summary: Packager Manager client library package
-Version: 0.2.77
+Version: 0.2.78
Release: 1
Group: System/Libraries
License: Apache License, Version 2.0
Packager Manager client library package for packaging
Requires(post): ail
-Requires(post): xkeyboard-config
%package client
Summary: Package Manager client library develpoment package
char *mime_type;
char *file_path;
const char *extension;
+ int request_id = 0;
if (__parse_argv(argc, argv, &mime_type, &file_path)) {
fprintf(stderr, "Failed to parse argv!\n");
int pid = fork();
if (pid == 0) {
pkgmgr_client *pc = pkgmgr_client_new(PC_REQUEST);
- pkgmgr_client_install(pc, extension, NULL, file_path, NULL,
+ request_id = pkgmgr_client_install(pc, extension, NULL, file_path, NULL,
PM_DEFAULT, NULL, NULL);
- pkgmgr_client_free(pc);
+ if (request_id < 0)
+ fprintf(stderr, "pkgmgr_client_install fail!\n");
+
+ request_id = pkgmgr_client_free(pc);
+ if (request_id < 0)
+ fprintf(stderr, "pkgmgr_client_free fail\n");
exit(0);
}