You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nuttx.apache.org by je...@apache.org on 2020/07/01 09:59:10 UTC

[incubator-nuttx-apps] branch master updated: nshlib: Call symlink if user pass -s for ln command

This is an automated email from the ASF dual-hosted git repository.

jerpelea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-nuttx-apps.git


The following commit(s) were added to refs/heads/master by this push:
     new 95d7e9b  nshlib: Call symlink if user pass -s for ln command
95d7e9b is described below

commit 95d7e9b191b62381e3a9825bad11cb59c196313b
Author: Xiang Xiao <xi...@xiaomi.com>
AuthorDate: Wed Jul 1 15:09:11 2020 +0800

    nshlib: Call symlink if user pass -s for ln command
    
    since NuttX kernel support really support symlink not link.
    Note: link equal symlink now because the hard link doesn't support yet
    
    Signed-off-by: Xiang Xiao <xi...@xiaomi.com>
    Change-Id: I47437f5fd8bbab3a5539d0eb6f690f633b422345
---
 nshlib/nsh_fscmds.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/nshlib/nsh_fscmds.c b/nshlib/nsh_fscmds.c
index 3008c04..4916c4d 100644
--- a/nshlib/nsh_fscmds.c
+++ b/nshlib/nsh_fscmds.c
@@ -1050,7 +1050,15 @@ int cmd_ln(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
       goto errout_with_tgtpath;
     }
 
-  ret = link(tgtpath, linkpath);
+  if (ndx == 1)
+    {
+      ret = link(tgtpath, linkpath);
+    }
+  else
+    {
+      ret = symlink(tgtpath, linkpath);
+    }
+
   if (ret < 0)
     {
       nsh_error(vtbl, g_fmtcmdfailed, argv[0], "link", NSH_ERRNO);