Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
LSH
lsh
Commits
fdbf58b1
Commit
fdbf58b1
authored
Mar 18, 2004
by
Niels Möller
Browse files
(read_file): Display a message if fopen fails.
Rev: src/nettle/examples/io.c:1.8
parent
6b29c800
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/nettle/examples/io.c
View file @
fdbf58b1
...
...
@@ -30,6 +30,10 @@
#include <stdarg.h>
#include <stdlib.h>
/* For errno and strerror */
#include <errno.h>
#include <string.h>
#include "io.h"
#define RANDOM_DEVICE "/dev/urandom"
...
...
@@ -74,8 +78,10 @@ read_file(const char *name, unsigned max_size, char **contents)
f
=
fopen
(
name
,
"rb"
);
if
(
!
f
)
return
0
;
{
werror
(
"Opening `%s' falied: %s
\n
"
,
name
,
strerror
(
errno
));
return
0
;
}
buffer
=
NULL
;
if
(
max_size
&&
max_size
<
100
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment