fix some error checking

This commit is contained in:
josch
2014-12-05 14:40:04 +01:00
parent c04151f2e1
commit dd3291a9c4
3 changed files with 9 additions and 5 deletions

View File

@@ -137,7 +137,7 @@ static int filecache_download_file(const char *filecache_path,
file = file_alloc();
retval = mfconn_api_file_get_links(conn, file, (char *)quickkey);
if (retval == -1) {
if (retval != 0) {
fprintf(stderr, "mfconn_api_file_get_links failed\n");
free(cachefile);
file_free(file);
@@ -304,7 +304,7 @@ static int filecache_download_patch(mfconn * conn, const char *quickkey,
retval = mfconn_api_device_get_patch(conn, patch, quickkey,
source_revision, target_revision);
if (retval == -1) {
if (retval != 0) {
fprintf(stderr, "mfconn_api_device_get_patch failed\n");
patch_free(patch);
return -1;

View File

@@ -1388,7 +1388,11 @@ void folder_tree_update(folder_tree * tree, mfconn * conn, bool expect_changes)
uint64_t revision;
if (!expect_changes) {
mfconn_api_device_get_status(conn, &revision_remote);
retval = mfconn_api_device_get_status(conn, &revision_remote);
if (retval != 0) {
fprintf(stderr, "device/get_status failed\n");
return;
}
if (tree->revision == revision_remote) {
fprintf(stderr, "Request to update but nothing to do\n");

View File

@@ -74,14 +74,14 @@ int mfshell_cmd_get(mfshell * mfshell, int argc, char *const argv[])
// get file name
retval = mfconn_api_file_get_info(mfshell->conn, file, (char *)quickkey);
if (retval == -1) {
if (retval != 0) {
file_free(file);
return -1;
}
// request a direct download (streaming) link
retval = mfconn_api_file_get_links(mfshell->conn, file, (char *)quickkey);
if (retval == -1) {
if (retval != 0) {
file_free(file);
return -1;
}