Skip to content

Commit

Permalink
Also check if we have a valid path in write_to_file
Browse files Browse the repository at this point in the history
Signed-off-by: Philippe De Swert <philippe.deswert@jollamobile.com>
  • Loading branch information
philippedeswert committed Oct 1, 2013
1 parent 4121597 commit 967f112
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/usb_moded-modesetting.c
Expand Up @@ -71,8 +71,12 @@ int write_to_file(const char *path, const char *text)
int fd = -1;
size_t todo = 0;

if(text)
todo = strlen(text);
/* if either path or the text to be written are not there
we return an error */
if(!text || !path)
return err;

todo = strlen(text);

/* no O_CREAT -> writes only to already existing files */
if( (fd = TEMP_FAILURE_RETRY(open(path, O_WRONLY))) == -1 )
Expand Down

0 comments on commit 967f112

Please sign in to comment.