Browse Source

nvs: fix fscanf return warning

master
Tanguy Pruvot 8 years ago
parent
commit
1473a8fd6f
  1. 10
      nvsettings.cpp

10
nvsettings.cpp

@ -78,9 +78,13 @@ int nvs_query_int(int nvs_id, const char* field, int showerr)
fp = popen(command, "r"); fp = popen(command, "r");
if (fp) { if (fp) {
int intval = -1; int intval = -1;
if (!showerr) if (!showerr) {
fscanf(fp, "%d", &intval); int b = fscanf(fp, "%d", &intval);
else { if (!b) {
pclose(fp);
return -1;
}
} else {
char msg[512] = { 0 }; char msg[512] = { 0 };
char buf[64] = { 0 }; char buf[64] = { 0 };
ssize_t bytes, len=0, maxlen=sizeof(msg)-1; ssize_t bytes, len=0, maxlen=sizeof(msg)-1;

Loading…
Cancel
Save