| Index: native_client_sdk/src/examples/demo/nacl_io/handlers.c
|
| diff --git a/native_client_sdk/src/examples/demo/nacl_io/handlers.c b/native_client_sdk/src/examples/demo/nacl_io/handlers.c
|
| index 062a41fb341343b7a4a2034da55d0e86254c44aa..5c2a6ab85ef725e6301fb55d795e30136c2dc493 100644
|
| --- a/native_client_sdk/src/examples/demo/nacl_io/handlers.c
|
| +++ b/native_client_sdk/src/examples/demo/nacl_io/handlers.c
|
| @@ -164,6 +164,12 @@ int HandleFwrite(int num_params, char** params, char** output) {
|
|
|
| bytes_written = fwrite(data, 1, data_len, file);
|
|
|
| + if (ferror(file)) {
|
| + *output = PrintfToNewString(
|
| + "Error: Wrote %d bytes, but ferror() returns true.", bytes_written);
|
| + return 3;
|
| + }
|
| +
|
| *output = PrintfToNewString("fwrite\1%s\1%d", file_index_string,
|
| bytes_written);
|
| return 0;
|
| @@ -211,6 +217,12 @@ int HandleFread(int num_params, char** params, char** output) {
|
| bytes_read = fread(buffer, 1, data_len, file);
|
| buffer[bytes_read] = 0;
|
|
|
| + if (ferror(file)) {
|
| + *output = PrintfToNewString(
|
| + "Error: Read %d bytes, but ferror() returns true.", bytes_read);
|
| + return 3;
|
| + }
|
| +
|
| *output = PrintfToNewString("fread\1%s\1%s", file_index_string, buffer);
|
| free(buffer);
|
| return 0;
|
|
|