Skip to content

Commit

Permalink
vfs: head: fix uninitialized var use
Browse files Browse the repository at this point in the history
  • Loading branch information
dexterbg committed Aug 10, 2019
1 parent 9083545 commit 316a217
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion vehicle/OVMS.V3/main/ovms_vfs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ void vfs_cat(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, cons

void vfs_head(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, const char* const* argv)
{
const char *filename;
const char *filename = NULL;
int nrlines = 20;

for (int i=0; i<argc; i++)
Expand All @@ -145,6 +145,11 @@ void vfs_head(int verbosity, OvmsWriter* writer, OvmsCommand* cmd, int argc, con
filename = argv[i];
}

if (!filename)
{
writer->puts("Error: no filename given");
return;
}
if (MyConfig.ProtectedPath(filename))
{
writer->puts("Error: protected path");
Expand Down

0 comments on commit 316a217

Please sign in to comment.