Skip to content

Commit

Permalink
[android] Fix android_write_file() return value checks
Browse files Browse the repository at this point in the history
Apparently refactoring from integer 0/-1 to boolean true/false
return value went slightly wrong - some call sites were not
adjusted accordingly.

Signed-off-by: Simo Piiroinen <simo.piiroinen@jollamobile.com>
  • Loading branch information
spiiroin committed Jan 28, 2020
1 parent a077a2b commit 79062f4
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/usb_moded-android.c
Expand Up @@ -247,7 +247,7 @@ android_set_enabled(bool enable)
bool ack = false;
if( android_in_use() ) {
const char *val = enable ? "1" : "0";
ack = android_write_file(ANDROID0_ENABLE, val) != -1;
ack = android_write_file(ANDROID0_ENABLE, val);
}
log_debug("ANDROID %s(%d) -> %d", __func__, enable, ack);
return ack;
Expand Down Expand Up @@ -304,7 +304,7 @@ android_set_function(const char *function)
if( !android_set_enabled(false) )
goto EXIT;

if( android_write_file(ANDROID0_FUNCTIONS, function) == -1 )
if( !android_write_file(ANDROID0_FUNCTIONS, function) )
goto EXIT;

/* Leave disabled, so that caller can adjust attributes
Expand Down Expand Up @@ -336,7 +336,7 @@ android_set_productid(const char *id)
snprintf(str, sizeof str, "%04x", num);
id = str;
}
ack = android_write_file(ANDROID0_ID_PRODUCT, id) != -1;
ack = android_write_file(ANDROID0_ID_PRODUCT, id);
}
log_debug("ANDROID %s(%s) -> %d", __func__, id, ack);
return ack;
Expand All @@ -360,7 +360,7 @@ android_set_vendorid(const char *id)
snprintf(str, sizeof str, "%04x", num);
id = str;
}
ack = android_write_file(ANDROID0_ID_VENDOR, id) != -1;
ack = android_write_file(ANDROID0_ID_VENDOR, id);
}
log_debug("ANDROID %s(%s) -> %d", __func__, id, ack);
return ack;
Expand Down

0 comments on commit 79062f4

Please sign in to comment.