I prefer 
```
  int ret = pkgmgrinfo_pkginfo_get_pkginfo(pkg_id.c_str(), &pkginfo_handle);
  if (ret != PMINFO_R_OK)
```