Report an error if cfs_write failed.
This commit is contained in:
parent
f9ca4a546d
commit
40f7541f88
@ -28,7 +28,7 @@
|
||||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: shell-file.c,v 1.13 2010/02/03 20:40:00 adamdunkels Exp $
|
||||
* $Id: shell-file.c,v 1.14 2010/04/12 13:21:58 nvt-se Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -139,6 +139,7 @@ PROCESS_THREAD(shell_append_process, ev, data)
|
||||
PROCESS_THREAD(shell_write_process, ev, data)
|
||||
{
|
||||
static int fd = 0;
|
||||
int r;
|
||||
|
||||
PROCESS_EXITHANDLER(cfs_close(fd));
|
||||
|
||||
@ -159,18 +160,24 @@ PROCESS_THREAD(shell_write_process, ev, data)
|
||||
cfs_close(fd);
|
||||
PROCESS_EXIT();
|
||||
}
|
||||
|
||||
|
||||
r = 0;
|
||||
if(input->len1 > 0) {
|
||||
cfs_write(fd, input->data1, input->len1);
|
||||
r = cfs_write(fd, input->data1, input->len1);
|
||||
}
|
||||
|
||||
if(input->len2 > 0) {
|
||||
cfs_write(fd, input->data2, input->len2);
|
||||
if(r >= 0 && input->len2 > 0) {
|
||||
r = cfs_write(fd, input->data2, input->len2);
|
||||
}
|
||||
|
||||
if(r < 0) {
|
||||
shell_output_str(&write_command, "write: could not write to the file",
|
||||
NULL);
|
||||
} else {
|
||||
shell_output(&write_command,
|
||||
input->data1, input->len1,
|
||||
input->data2, input->len2);
|
||||
}
|
||||
|
||||
shell_output(&write_command,
|
||||
input->data1, input->len1,
|
||||
input->data2, input->len2);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user