mirror of
https://github.com/xorgy/mediafire-fuse
synced 2026-01-13 13:14:29 -08:00
fix some error checking
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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");
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user