Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.2
jshon
0001-check-for-a-error-on-file-open-with-F-opti...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0001-check-for-a-error-on-file-open-with-F-option.patch of Package jshon
From 7579558b8018d4abcd0a4ee0a16d9be467a5744a Mon Sep 17 00:00:00 2001 From: Jordan Metzmeier <jmetzmeier01@gmail.com> Date: Tue, 19 Nov 2013 22:38:49 -0600 Subject: [PATCH 1/2] check for a error on file open with -F option --- jshon.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/jshon.c b/jshon.c index f42b6da..ad0fb7c 100644 --- a/jshon.c +++ b/jshon.c @@ -375,6 +375,10 @@ char* read_file(char* path) FILE* fp; char* content; fp = fopen(path, "r"); + if ( !fp ) { + fprintf(stderr, "unable to read file %s: %s\n", path, strerror(errno)); + return NULL; + } content = read_stream(fp); fclose(fp); return content; @@ -927,6 +931,11 @@ int main (int argc, char *argv[]) {content = read_file(file_path);} else {content = read_stdin();} + if (!content) { + fprintf(stderr, "error: failed to read input\n"); + exit(1); + } + if (!content[0] && !quiet) {fprintf(stderr, "warning: nothing to read\n");} -- 2.16.4
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor