From 64c7e3189628a1197467aa878bb81a717c7a1da4 Mon Sep 17 00:00:00 2001 From: Gregory Nutt Date: Sat, 28 Nov 2015 11:57:37 -0600 Subject: [PATCH] nshlib: Correct an error message --- nshlib/nsh_fsutils.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/nshlib/nsh_fsutils.c b/nshlib/nsh_fsutils.c index cda40087a..a9d6a9b36 100644 --- a/nshlib/nsh_fsutils.c +++ b/nshlib/nsh_fsutils.c @@ -189,8 +189,9 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, * Name: nsh_readfile * * Description: - * Read a small file into a buffer buffer. An error occurs if the file - * will not fit into the buffer. + * Read a small file into a user-provided buffer. The data is assumed to + * be a string and is guaranteed to be NUL-termined. An error occurs if + * the file content (+terminator) will not fit into the provided 'buffer'. * * Input Paramters: * vtbl - The console vtable @@ -318,21 +319,20 @@ int nsh_foreach_direntry(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd, /* Open the directory */ dirp = opendir(dirpath); - - if (!dirp) + if (dirp == NULL) { /* Failed to open the directory */ - nsh_output(vtbl, g_fmtnosuch, cmd, "opendir", dirpath); + nsh_output(vtbl, g_fmtnosuch, cmd, "directory", dirpath); return ERROR; } /* Read each directory entry */ - for (;;) + for (; ; ) { FAR struct dirent *entryp = readdir(dirp); - if (!entryp) + if (entryp == NULL) { /* Finished with this directory */