This is an automated email from the ASF dual-hosted git repository. gnutt pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git
commit ff866b95272c7ad39e34658b16495567c4befff4 Author: David Sidrane <david.sidr...@nscdg.com> AuthorDate: Wed Sep 30 12:11:56 2020 -0700 fsutils:ipcfg Fix fd propagation as return value in bin mode With CONFIG_IPCFG_BINARY lit. ipcfg_open needs to return the fd or an -errno. It was returning OK not the fd. --- fsutils/ipcfg/ipcfg.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/fsutils/ipcfg/ipcfg.c b/fsutils/ipcfg/ipcfg.c index e6763b4..b809dd7 100644 --- a/fsutils/ipcfg/ipcfg.c +++ b/fsutils/ipcfg/ipcfg.c @@ -201,8 +201,6 @@ static int ipcfg_open(FAR const char *netdev, int oflags, mode_t mode) /* Now open the file */ fd = open(path, oflags, mode); - ret = OK; - if (fd < 0) { ret = -errno; @@ -220,11 +218,14 @@ static int ipcfg_open(FAR const char *netdev, int oflags, mode_t mode) if (ret < 0) { ret = -errno; + close(fd); fprintf(stderr, "ERROR: Failed to seek to $ld: %d\n", (long)CONFIG_IPCFG_OFFSET, ret); - close(fd); + goto errout_with_path; } + #endif + ret = fd; errout_with_path: free(path);