summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/fs/ntapi_tt_istat.c8
-rw-r--r--src/fs/ntapi_tt_stat.c9
-rw-r--r--src/fs/ntapi_tt_statfs.c21
3 files changed, 15 insertions, 23 deletions
diff --git a/src/fs/ntapi_tt_istat.c b/src/fs/ntapi_tt_istat.c
index 25d098c..99e0a1d 100644
--- a/src/fs/ntapi_tt_istat.c
+++ b/src/fs/ntapi_tt_istat.c
@@ -137,20 +137,16 @@ int32_t __stdcall __ntapi_tt_istat(
wch_mark,
(uintptr_t)wch - (uintptr_t)wch_mark);
- if (!(flags & NT_ISTAT_DEV_NAME_COPY)) {
- istat->dev_name[0] = 0;
+ if (!(flags & NT_ISTAT_DEV_NAME_COPY))
return NT_STATUS_SUCCESS;
- } else if (istat->dev_name_maxlen < sdev->strlen) {
- istat->dev_name[0] = 0;
+ else if (istat->dev_name_maxlen < istat->dev_name_strlen)
return NT_STATUS_BUFFER_TOO_SMALL;
- }
__ntapi->tt_memcpy_utf16(
istat->dev_name,
sdev->buffer,
istat->dev_name_strlen);
-
return status;
}
diff --git a/src/fs/ntapi_tt_stat.c b/src/fs/ntapi_tt_stat.c
index 7c7afed..b94b08f 100644
--- a/src/fs/ntapi_tt_stat.c
+++ b/src/fs/ntapi_tt_stat.c
@@ -144,18 +144,15 @@ int32_t __stdcall __ntapi_tt_stat(
hash,wch_mark,
sizeof(wchar16_t)*(wch-wch_mark));
- if (!(flags & NT_STAT_DEV_NAME_COPY)) {
- *stat->dev_name = 0;
+ if (!(flags & NT_STAT_DEV_NAME_COPY))
return NT_STATUS_SUCCESS;
- } else if (stat->dev_name_maxlen < sdev->strlen) {
- *stat->dev_name = 0;
+ else if (stat->dev_name_maxlen < sdev->strlen)
return NT_STATUS_BUFFER_TOO_SMALL;
- }
__ntapi->tt_memcpy_utf16(
(wchar16_t *)stat->dev_name,
(wchar16_t *)sdev->buffer,
- stat->dev_name_strlen);
+ sdev->strlen);
return NT_STATUS_SUCCESS;
}
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) */