summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/afc.c2
-rw-r--r--src/device_link_service.c2
-rw-r--r--src/diagnostics_relay.c2
-rw-r--r--src/file_relay.c2
-rw-r--r--src/heartbeat.c6
-rw-r--r--src/house_arrest.c3
-rw-r--r--src/installation_proxy.c8
-rw-r--r--src/misagent.c3
-rw-r--r--src/mobile_image_mounter.c8
-rw-r--r--src/mobilebackup.c5
-rw-r--r--src/mobilebackup2.c2
-rw-r--r--src/mobilesync.c2
-rw-r--r--src/notification_proxy.c8
-rw-r--r--src/property_list_service.c2
-rw-r--r--src/sbservices.c3
-rw-r--r--src/screenshotr.c2
-rw-r--r--src/service.c4
-rw-r--r--src/webinspector.c6
18 files changed, 27 insertions, 43 deletions
diff --git a/src/afc.c b/src/afc.c
index d61032d..c281e2c 100644
--- a/src/afc.c
+++ b/src/afc.c
@@ -123,7 +123,7 @@ afc_error_t afc_client_new_with_service_client(service_client_t service_client,
*/
afc_error_t afc_client_new(idevice_t device, lockdownd_service_descriptor_t service, afc_client_t * client)
{
- if (!device || service->port == 0)
+ if (!device || !service || service->port == 0)
return AFC_E_INVALID_ARG;
service_client_t parent = NULL;
diff --git a/src/device_link_service.c b/src/device_link_service.c
index ac89211..2608b9f 100644
--- a/src/device_link_service.c
+++ b/src/device_link_service.c
@@ -84,7 +84,7 @@ static int device_link_service_get_message(plist_t dl_msg, char **message)
*/
device_link_service_error_t device_link_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, device_link_service_client_t *client)
{
- if (!device || service->port == 0 || !client || *client) {
+ if (!device || !service || service->port == 0 || !client || *client) {
return DEVICE_LINK_SERVICE_E_INVALID_ARG;
}
diff --git a/src/diagnostics_relay.c b/src/diagnostics_relay.c
index 3469ae4..506b901 100644
--- a/src/diagnostics_relay.c
+++ b/src/diagnostics_relay.c
@@ -83,7 +83,7 @@ static int diagnostics_relay_check_result(plist_t dict)
*/
diagnostics_relay_error_t diagnostics_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, diagnostics_relay_client_t *client)
{
- if (!device || service->port == 0 || !client || *client) {
+ if (!device || !service || service->port == 0 || !client || *client) {
return DIAGNOSTICS_RELAY_E_INVALID_ARG;
}
diff --git a/src/file_relay.c b/src/file_relay.c
index 39382fb..b1adb4f 100644
--- a/src/file_relay.c
+++ b/src/file_relay.c
@@ -38,7 +38,7 @@
*/
file_relay_error_t file_relay_client_new(idevice_t device, lockdownd_service_descriptor_t service, file_relay_client_t *client)
{
- if (!device || service->port == 0 || !client || *client) {
+ if (!device || !service || service->port == 0 || !client || *client) {
return FILE_RELAY_E_INVALID_ARG;
}
diff --git a/src/heartbeat.c b/src/heartbeat.c
index 0f8d2f3..cee852e 100644
--- a/src/heartbeat.c
+++ b/src/heartbeat.c
@@ -74,13 +74,13 @@ heartbeat_error_t heartbeat_client_new(idevice_t device, lockdownd_service_descr
{
*client = NULL;
- debug_info("Creating heartbeat_client, port = %d.", service->port);
-
- if (!device || service->port == 0 || !client || *client) {
+ if (!device || !service || service->port == 0 || !client || *client) {
debug_info("Incorrect parameter passed to heartbeat_client_new.");
return HEARTBEAT_E_INVALID_ARG;
}
+ debug_info("Creating heartbeat_client, port = %d.", service->port);
+
property_list_service_client_t plclient = NULL;
heartbeat_error_t ret = heartbeat_error(property_list_service_client_new(device, service, &plclient));
if (ret != HEARTBEAT_E_SUCCESS) {
diff --git a/src/house_arrest.c b/src/house_arrest.c
index b3dbbf8..5dfd1b6 100644
--- a/src/house_arrest.c
+++ b/src/house_arrest.c
@@ -68,9 +68,6 @@ static house_arrest_error_t house_arrest_error(property_list_service_error_t err
*/
house_arrest_error_t house_arrest_client_new(idevice_t device, lockdownd_service_descriptor_t service, house_arrest_client_t *client)
{
- if (!device)
- return HOUSE_ARREST_E_INVALID_ARG;
-
property_list_service_client_t plistclient = NULL;
house_arrest_error_t err = house_arrest_error(property_list_service_client_new(device, service, &plistclient));
if (err != HOUSE_ARREST_E_SUCCESS) {
diff --git a/src/installation_proxy.c b/src/installation_proxy.c
index eacab9d..d4c1750 100644
--- a/src/installation_proxy.c
+++ b/src/installation_proxy.c
@@ -104,12 +104,10 @@ static instproxy_error_t instproxy_error(property_list_service_error_t err)
*/
instproxy_error_t instproxy_client_new(idevice_t device, lockdownd_service_descriptor_t service, instproxy_client_t *client)
{
- if (!device)
- return INSTPROXY_E_INVALID_ARG;
-
property_list_service_client_t plistclient = NULL;
- if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
- return INSTPROXY_E_CONN_FAILED;
+ instproxy_error_t err = instproxy_error(property_list_service_client_new(device, service, &plistclient));
+ if (err != INSTPROXY_E_SUCCESS) {
+ return err;
}
instproxy_client_t client_loc = (instproxy_client_t) malloc(sizeof(struct instproxy_client_private));
diff --git a/src/misagent.c b/src/misagent.c
index cb84188..1bc4519 100644
--- a/src/misagent.c
+++ b/src/misagent.c
@@ -100,9 +100,6 @@ static misagent_error_t misagent_check_result(plist_t response, int* status_code
*/
misagent_error_t misagent_client_new(idevice_t device, lockdownd_service_descriptor_t service, misagent_client_t *client)
{
- if (!device)
- return MISAGENT_E_INVALID_ARG;
-
property_list_service_client_t plistclient = NULL;
misagent_error_t err = misagent_error(property_list_service_client_new(device, service, &plistclient));
if (err != MISAGENT_E_SUCCESS) {
diff --git a/src/mobile_image_mounter.c b/src/mobile_image_mounter.c
index 3e31ef4..1d608db 100644
--- a/src/mobile_image_mounter.c
+++ b/src/mobile_image_mounter.c
@@ -98,12 +98,10 @@ static mobile_image_mounter_error_t mobile_image_mounter_error(property_list_ser
*/
mobile_image_mounter_error_t mobile_image_mounter_new(idevice_t device, lockdownd_service_descriptor_t service, mobile_image_mounter_client_t *client)
{
- if (!device)
- return MOBILE_IMAGE_MOUNTER_E_INVALID_ARG;
-
property_list_service_client_t plistclient = NULL;
- if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
- return MOBILE_IMAGE_MOUNTER_E_CONN_FAILED;
+ mobile_image_mounter_error_t err = mobile_image_mounter_error(property_list_service_client_new(device, service, &plistclient));
+ if (err != MOBILE_IMAGE_MOUNTER_E_SUCCESS) {
+ return err;
}
mobile_image_mounter_client_t client_loc = (mobile_image_mounter_client_t) malloc(sizeof(struct mobile_image_mounter_client_private));
diff --git a/src/mobilebackup.c b/src/mobilebackup.c
index ab4dec0..aae4b06 100644
--- a/src/mobilebackup.c
+++ b/src/mobilebackup.c
@@ -72,10 +72,9 @@ static mobilebackup_error_t mobilebackup_error(device_link_service_error_t err)
* or more parameters are invalid, or DEVICE_LINK_SERVICE_E_BAD_VERSION if
* the mobilebackup version on the device is newer.
*/
-mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service,
- mobilebackup_client_t * client)
+mobilebackup_error_t mobilebackup_client_new(idevice_t device, lockdownd_service_descriptor_t service, mobilebackup_client_t * client)
{
- if (!device || service->port == 0 || !client || *client)
+ if (!device || !service || service->port == 0 || !client || *client)
return MOBILEBACKUP_E_INVALID_ARG;
device_link_service_client_t dlclient = NULL;
diff --git a/src/mobilebackup2.c b/src/mobilebackup2.c
index 15ba469..6356376 100644
--- a/src/mobilebackup2.c
+++ b/src/mobilebackup2.c
@@ -76,7 +76,7 @@ static mobilebackup2_error_t mobilebackup2_error(device_link_service_error_t err
mobilebackup2_error_t mobilebackup2_client_new(idevice_t device, lockdownd_service_descriptor_t service,
mobilebackup2_client_t * client)
{
- if (!device || service->port == 0 || !client || *client)
+ if (!device || !service || service->port == 0 || !client || *client)
return MOBILEBACKUP2_E_INVALID_ARG;
device_link_service_client_t dlclient = NULL;
diff --git a/src/mobilesync.c b/src/mobilesync.c
index 4fe24b2..af70ea4 100644
--- a/src/mobilesync.c
+++ b/src/mobilesync.c
@@ -81,7 +81,7 @@ static mobilesync_error_t mobilesync_error(device_link_service_error_t err)
mobilesync_error_t mobilesync_client_new(idevice_t device, lockdownd_service_descriptor_t service,
mobilesync_client_t * client)
{
- if (!device || service->port == 0 || !client || *client)
+ if (!device || !service || service->port == 0 || !client || *client)
return MOBILESYNC_E_INVALID_ARG;
device_link_service_client_t dlclient = NULL;
diff --git a/src/notification_proxy.c b/src/notification_proxy.c
index 8fb9ad0..5b293f8 100644
--- a/src/notification_proxy.c
+++ b/src/notification_proxy.c
@@ -108,12 +108,10 @@ static np_error_t np_error(property_list_service_error_t err)
*/
np_error_t np_client_new(idevice_t device, lockdownd_service_descriptor_t service, np_client_t *client)
{
- if (!device)
- return NP_E_INVALID_ARG;
-
property_list_service_client_t plistclient = NULL;
- if (property_list_service_client_new(device, service, &plistclient) != PROPERTY_LIST_SERVICE_E_SUCCESS) {
- return NP_E_CONN_FAILED;
+ np_error_t err = np_error(property_list_service_client_new(device, service, &plistclient));
+ if (err != NP_E_SUCCESS) {
+ return err;
}
np_client_t client_loc = (np_client_t) malloc(sizeof(struct np_client_private));
diff --git a/src/property_list_service.c b/src/property_list_service.c
index 025a9bc..941f37e 100644
--- a/src/property_list_service.c
+++ b/src/property_list_service.c
@@ -68,7 +68,7 @@ static property_list_service_error_t service_to_property_list_service_error(serv
*/
property_list_service_error_t property_list_service_client_new(idevice_t device, lockdownd_service_descriptor_t service, property_list_service_client_t *client)
{
- if (!device || (service->port == 0) || !client || *client)
+ if (!device || !service || service->port == 0 || !client || *client)
return PROPERTY_LIST_SERVICE_E_INVALID_ARG;
service_client_t parent = NULL;
diff --git a/src/sbservices.c b/src/sbservices.c
index 6b1a4d1..00f2862 100644
--- a/src/sbservices.c
+++ b/src/sbservices.c
@@ -97,9 +97,6 @@ static sbservices_error_t sbservices_error(property_list_service_error_t err)
*/
sbservices_error_t sbservices_client_new(idevice_t device, lockdownd_service_descriptor_t service, sbservices_client_t *client)
{
- if (!device)
- return SBSERVICES_E_INVALID_ARG;
-
property_list_service_client_t plistclient = NULL;
sbservices_error_t err = sbservices_error(property_list_service_client_new(device, service, &plistclient));
if (err != SBSERVICES_E_SUCCESS) {
diff --git a/src/screenshotr.c b/src/screenshotr.c
index e2bc979..b538232 100644
--- a/src/screenshotr.c
+++ b/src/screenshotr.c
@@ -76,7 +76,7 @@ static screenshotr_error_t screenshotr_error(device_link_service_error_t err)
screenshotr_error_t screenshotr_client_new(idevice_t device, lockdownd_service_descriptor_t service,
screenshotr_client_t * client)
{
- if (!device || service->port == 0 || !client || *client)
+ if (!device || !service || service->port == 0 || !client || *client)
return SCREENSHOTR_E_INVALID_ARG;
device_link_service_client_t dlclient = NULL;
diff --git a/src/service.c b/src/service.c
index 959c9fb..abd1696 100644
--- a/src/service.c
+++ b/src/service.c
@@ -66,7 +66,7 @@ static service_error_t idevice_to_service_error(idevice_error_t err)
*/
service_error_t service_client_new(idevice_t device, lockdownd_service_descriptor_t service, service_client_t *client)
{
- if (!device || (service->port == 0) || !client || *client)
+ if (!device || !service || service->port == 0 || !client || *client)
return SERVICE_E_INVALID_ARG;
/* Attempt connection */
@@ -117,7 +117,7 @@ service_error_t service_client_factory_start_service(idevice_t device, const cha
lockdownd_start_service(lckd, service_name, &service);
lockdownd_client_free(lckd);
- if (service->port <= 0) {
+ if (!service || service->port == 0) {
debug_info("Could not start service %s!", service_name);
return SERVICE_E_START_SERVICE_ERROR;
}
diff --git a/src/webinspector.c b/src/webinspector.c
index fea26d4..aef6d6f 100644
--- a/src/webinspector.c
+++ b/src/webinspector.c
@@ -74,13 +74,13 @@ webinspector_error_t webinspector_client_new(idevice_t device, lockdownd_service
{
*client = NULL;
- debug_info("Creating webinspector_client, port = %d.", service->port);
-
- if (!device || service->port == 0 || !client || *client) {
+ if (!device || !service || service->port == 0 || !client || *client) {
debug_info("Incorrect parameter passed to webinspector_client_new.");
return WEBINSPECTOR_E_INVALID_ARG;
}
+ debug_info("Creating webinspector_client, port = %d.", service->port);
+
property_list_service_client_t plclient = NULL;
webinspector_error_t ret = webinspector_error(property_list_service_client_new(device, service, &plclient));
if (ret != WEBINSPECTOR_E_SUCCESS) {