summaryrefslogtreecommitdiffstats
path: root/gl/stat.c
diff options
context:
space:
mode:
Diffstat (limited to 'gl/stat.c')
-rw-r--r--gl/stat.c16
1 files changed, 4 insertions, 12 deletions
diff --git a/gl/stat.c b/gl/stat.c
index 66637837..da6a9862 100644
--- a/gl/stat.c
+++ b/gl/stat.c
@@ -1,5 +1,5 @@
1/* Work around platform bugs in stat. 1/* Work around platform bugs in stat.
2 Copyright (C) 2009-2025 Free Software Foundation, Inc. 2 Copyright (C) 2009-2026 Free Software Foundation, Inc.
3 3
4 This file is free software: you can redistribute it and/or modify 4 This file is free software: you can redistribute it and/or modify
5 it under the terms of the GNU Lesser General Public License as 5 it under the terms of the GNU Lesser General Public License as
@@ -42,14 +42,7 @@ orig_stat (const char *filename, struct stat *buf)
42#endif 42#endif
43 43
44/* Specification. */ 44/* Specification. */
45#ifdef __osf__ 45#include <sys/stat.h>
46/* Write "sys/stat.h" here, not <sys/stat.h>, otherwise OSF/1 5.1 DTK cc
47 eliminates this include because of the preliminary #include <sys/stat.h>
48 above. */
49# include "sys/stat.h"
50#else
51# include <sys/stat.h>
52#endif
53 46
54#include "stat-time.h" 47#include "stat-time.h"
55 48
@@ -119,7 +112,7 @@ rpl_stat (char const *name, struct stat *buf)
119 <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */ 112 <https://docs.microsoft.com/en-us/windows/desktop/FileIO/naming-a-file> ? */
120 113
121 /* To ease portability. Like in open.c. */ 114 /* To ease portability. Like in open.c. */
122 if (strcmp (name, "/dev/null") == 0) 115 if (streq (name, "/dev/null"))
123 name = "NUL"; 116 name = "NUL";
124 117
125 /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13> 118 /* POSIX <https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html#tag_04_13>
@@ -294,8 +287,7 @@ rpl_stat (char const *name, struct stat *buf)
294 if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0) 287 if (info.nFileSizeHigh > 0 || info.nFileSizeLow > 0)
295 { 288 {
296 const char *last_dot = NULL; 289 const char *last_dot = NULL;
297 const char *p; 290 for (const char *p = info.cFileName; *p != '\0'; p++)
298 for (p = info.cFileName; *p != '\0'; p++)
299 if (*p == '.') 291 if (*p == '.')
300 last_dot = p; 292 last_dot = p;
301 if (last_dot != NULL) 293 if (last_dot != NULL)