diff options
author | midipix <writeonce@midipix.org> | 2016-12-24 15:18:50 +0000 |
---|---|---|
committer | midipix <writeonce@midipix.org> | 2016-12-25 01:30:59 -0500 |
commit | 31ee70d0195fc172077ef4bd8201465b8434c4d3 (patch) | |
tree | 6ad09b5b263ce7dcb7ad5c5443f78f77db813779 /src/fs/ntapi_tt_statfs.c | |
parent | 5765437d866e6da27f5b7cc9b30f9dac41dce9f9 (diff) | |
download | ntapi-31ee70d0195fc172077ef4bd8201465b8434c4d3.tar.bz2 ntapi-31ee70d0195fc172077ef4bd8201465b8434c4d3.tar.xz |
__ntapi_tt_{i}stat{fs}(): [semantic] clean-up: device/file name copy.
Diffstat (limited to 'src/fs/ntapi_tt_statfs.c')
-rw-r--r-- | src/fs/ntapi_tt_statfs.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/fs/ntapi_tt_statfs.c b/src/fs/ntapi_tt_statfs.c index aed6374..f38509e 100644 --- a/src/fs/ntapi_tt_statfs.c +++ b/src/fs/ntapi_tt_statfs.c @@ -187,17 +187,16 @@ int32_t __stdcall __ntapi_tt_statfs( wch_mark, sizeof(wchar16_t) * (wch - wch_mark)); - /* copy device name (optional, no failure) */ - if (flags & NT_STATFS_DEV_NAME_COPY) { - if (statfs->dev_name_maxlen < sdev->strlen) - *statfs->dev_name = 0; - else - __ntapi->tt_memcpy_utf16( - (wchar16_t *)statfs->dev_name, - (wchar16_t *)sdev->buffer, - sdev->strlen); - } else - *statfs->dev_name = 0; + /* device name */ + if (!(flags & NT_STATFS_DEV_NAME_COPY)) + (void)0; + else if (statfs->dev_name_maxlen < sdev->strlen) + return NT_STATUS_BUFFER_TOO_SMALL; + else + __ntapi->tt_memcpy_utf16( + statfs->dev_name, + sdev->buffer, + sdev->strlen); /* f_fsid: hash of the system-unique device name */ /* (never use the volume serial number) */ |