Fixed coding std violations in nsh_fsutils.h

This commit is contained in:
Subhra Sankha Sarkar
2020-10-28 18:00:33 +05:30
committed by Xiang Xiao
parent 0d74608b2c
commit 76e58d9e55

View File

@@ -102,7 +102,7 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
} }
buffer = (FAR char *)malloc(IOBUFFERSIZE); buffer = (FAR char *)malloc(IOBUFFERSIZE);
if(buffer == NULL) if (buffer == NULL)
{ {
close(fd); close(fd);
nsh_error(vtbl, g_fmtcmdfailed, cmd, "malloc", NSH_ERRNO); nsh_error(vtbl, g_fmtcmdfailed, cmd, "malloc", NSH_ERRNO);
@@ -111,7 +111,7 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
/* And just dump it byte for byte into stdout */ /* And just dump it byte for byte into stdout */
for (;;) for (; ; )
{ {
int nbytesread = read(fd, buffer, IOBUFFERSIZE); int nbytesread = read(fd, buffer, IOBUFFERSIZE);
@@ -129,7 +129,8 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
} }
else else
{ {
nsh_error(vtbl, g_fmtcmdfailed, cmd, "read", NSH_ERRNO_OF(errval)); nsh_error(vtbl, g_fmtcmdfailed, cmd, "read",
NSH_ERRNO_OF(errval));
} }
ret = ERROR; ret = ERROR;
@@ -144,7 +145,8 @@ int nsh_catfile(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd,
while (nbyteswritten < nbytesread) while (nbyteswritten < nbytesread)
{ {
ssize_t n = nsh_write(vtbl, buffer + nbyteswritten, nbytesread - nbyteswritten); ssize_t n = nsh_write(vtbl, buffer + nbyteswritten,
nbytesread - nbyteswritten);
if (n < 0) if (n < 0)
{ {
int errcode = errno; int errcode = errno;