Better error handling if the file could not be opened
This commit is contained in:
parent
fa9a34993f
commit
f4f812d81a
@ -28,7 +28,7 @@
|
|||||||
*
|
*
|
||||||
* This file is part of the Contiki operating system.
|
* This file is part of the Contiki operating system.
|
||||||
*
|
*
|
||||||
* $Id: shell-netfile.c,v 1.3 2008/07/03 09:50:23 adamdunkels Exp $
|
* $Id: shell-netfile.c,v 1.4 2008/07/03 21:14:29 adamdunkels Exp $
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -121,15 +121,16 @@ PROCESS_THREAD(shell_netfile_process, ev, data)
|
|||||||
|
|
||||||
PROCESS_BEGIN();
|
PROCESS_BEGIN();
|
||||||
|
|
||||||
rudolph0_send(&rudolph0_conn, CLOCK_SECOND);
|
|
||||||
if(data != NULL) {
|
if(data != NULL) {
|
||||||
strcpy(filename, data);
|
rudolph0_send(&rudolph0_conn, CLOCK_SECOND);
|
||||||
}
|
|
||||||
fd = cfs_open(filename, CFS_READ);
|
strncpy(filename, data, FILENAME_LEN);
|
||||||
if(fd < 0) {
|
fd = cfs_open(filename, CFS_READ);
|
||||||
shell_output_str(&netfile_command, "netfile: could not open file ", filename);
|
if(fd < 0) {
|
||||||
} else {
|
shell_output_str(&netfile_command, "netfile: could not open file ", filename);
|
||||||
cfs_close(fd);
|
} else {
|
||||||
|
cfs_close(fd);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
PROCESS_END();
|
PROCESS_END();
|
||||||
|
Loading…
Reference in New Issue
Block a user