summaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
authormidipix <writeonce@midipix.org>2018-08-05 04:41:32 -0400
committermidipix <writeonce@midipix.org>2018-08-05 04:52:35 -0400
commit4ce9ee82745459202f18e507e7b1ead355a41ff1 (patch)
treeed66fa89265a4444ea5fd9ef18ff9dc1f80b31a1 /src
parent58ff53ecb9f51ce0724d30e81bc14098a04a5bea (diff)
downloadntux-4ce9ee82745459202f18e507e7b1ead355a41ff1.tar.bz2
ntux-4ce9ee82745459202f18e507e7b1ead355a41ff1.tar.xz
ntux_cmd_stat(): integrated the driver's fdctx.
Diffstat (limited to 'src')
-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);