Better error handling if the file could not be opened

This commit is contained in:
adamdunkels 2008-07-03 21:14:29 +00:00
parent fa9a34993f
commit f4f812d81a
1 changed files with 10 additions and 9 deletions

View File

@ -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,16 +121,17 @@ 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);
}
strncpy(filename, data, FILENAME_LEN);
fd = cfs_open(filename, CFS_READ); fd = cfs_open(filename, CFS_READ);
if(fd < 0) { if(fd < 0) {
shell_output_str(&netfile_command, "netfile: could not open file ", filename); shell_output_str(&netfile_command, "netfile: could not open file ", filename);
} else { } else {
cfs_close(fd); cfs_close(fd);
} }
}
PROCESS_END(); PROCESS_END();
} }