From 4ce9ee82745459202f18e507e7b1ead355a41ff1 Mon Sep 17 00:00:00 2001 From: midipix Date: Sun, 5 Aug 2018 04:41:32 -0400 Subject: ntux_cmd_stat(): integrated the driver's fdctx. --- src/cmds/ntux_cmd_stat.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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); -- cgit v1.2.3