summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/cmds/ntux_cmd_stat.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/cmds/ntux_cmd_stat.c b/src/cmds/ntux_cmd_stat.c
index 63f82cd..8634c4a 100644
--- a/src/cmds/ntux_cmd_stat.c
+++ b/src/cmds/ntux_cmd_stat.c
@@ -38,6 +38,8 @@ int ntux_cmd_stat(const struct ntux_driver_ctx * dctx, const char * dunit)
{
intptr_t ret;
int32_t status;
+ int fdout;
+ int fdcwd;
const unsigned char * unit;
nt_stat * nstat;
struct __stat st;
@@ -54,8 +56,12 @@ int ntux_cmd_stat(const struct ntux_driver_ctx * dctx, const char * dunit)
unit = (const unsigned char *)dunit;
+ /* fdctx */
+ fdout = ntux_driver_fdout(dctx);
+ fdcwd = ntux_driver_fdcwd(dctx);
+
/* open */
- if ((ret = __sys_open(unit,0,0)) < 0)
+ if ((ret = __sys_openat(fdcwd,unit,0,0)) < 0)
if (ntux_errno_set(dctx,ret))
return ntux_cmd_stat_ret(
fd,ofd,buf,sbuf,
@@ -113,10 +119,10 @@ int ntux_cmd_stat(const struct ntux_driver_ctx * dctx, const char * dunit)
fd,ofd,buf,sbuf,
NTUX_NATIVE_ERROR(dctx,status));
- ntux_dprintf(STDOUT_FILENO,"fname: %s\n",str);
+ ntux_dprintf(fdout,"fname: %s\n",str);
/* inode */
- ntux_dprintf(STDOUT_FILENO,"inode: 0x%p (%lld)\n",st.st_ino,st.st_ino);
+ ntux_dprintf(fdout,"inode: 0x%p (%lld)\n",st.st_ino,st.st_ino);
/* all done */
return ntux_cmd_stat_ret(fd,ofd,buf,sbuf,0);