summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMikael Magnusson <mikachu@gmail.com>2026-05-12 21:45:07 +0200
committerMikael Magnusson <mikachu@gmail.com>2026-05-16 18:28:31 +0200
commite555255eef69bd5737a733715cdadf10a97eb82e (patch)
treefafca463bbb9923c0e7bb17c0e392f8a3ad95ec9
parent54562: random: Fix some bugs in the random module (diff)
downloadzsh-e555255eef69bd5737a733715cdadf10a97eb82e.tar
zsh-e555255eef69bd5737a733715cdadf10a97eb82e.tar.gz
zsh-e555255eef69bd5737a733715cdadf10a97eb82e.tar.bz2
zsh-e555255eef69bd5737a733715cdadf10a97eb82e.tar.lz
zsh-e555255eef69bd5737a733715cdadf10a97eb82e.tar.xz
zsh-e555255eef69bd5737a733715cdadf10a97eb82e.tar.zst
zsh-e555255eef69bd5737a733715cdadf10a97eb82e.zip
54563: stat, system: minor fixes
-rw-r--r--ChangeLog3
-rw-r--r--Src/Modules/stat.c6
-rw-r--r--Src/Modules/system.c3
3 files changed, 8 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 59823bcdf..e7768cc1d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
2026-05-16 Mikael Magnusson <mikachu@gmail.com>
+ * 54563: Src/Modules/stat.c, Src/Modules/system.c: stat, system:
+ minor fixes
+
* 54562: Doc/Zsh/mod_random.yo, Src/Modules/random.c,
Src/Modules/random_real.c: random: Fix some bugs in the random
module
diff --git a/Src/Modules/stat.c b/Src/Modules/stat.c
index 5bf201dd3..f7ec06e9e 100644
--- a/Src/Modules/stat.c
+++ b/Src/Modules/stat.c
@@ -191,14 +191,14 @@ static void
stattimeprint(time_t tim, long nsecs, char *outbuf, int flags)
{
if (flags & STF_RAW) {
- sprintf(outbuf, "%ld", (unsigned long)tim);
+ sprintf(outbuf, "%ld", (long)tim);
if (flags & STF_STRING)
strcat(outbuf, " (");
}
if (flags & STF_STRING) {
char *oend = outbuf + strlen(outbuf);
- /* Where the heck does "40" come from? */
- ztrftime(oend, 40, timefmt, (flags & STF_GMT) ? gmtime(&tim) :
+ /* the buffer is PATH_MAX+9 long, but we already printed some stuff */
+ ztrftime(oend, PATH_MAX - DIGBUFSIZE - 10, timefmt, (flags & STF_GMT) ? gmtime(&tim) :
localtime(&tim), nsecs);
if (flags & STF_RAW)
strcat(oend, ")");
diff --git a/Src/Modules/system.c b/Src/Modules/system.c
index 1f3665dba..3c0b8421a 100644
--- a/Src/Modules/system.c
+++ b/Src/Modules/system.c
@@ -686,7 +686,8 @@ bin_zsystem_flock(char *nam, char **args, UNUSED(Options ops), UNUSED(int func))
else
flags = O_RDWR | O_NOCTTY;
if ((flock_fd = open(unmeta(args[0]), flags)) < 0) {
- zwarnnam(nam, "failed to open %s for writing: %e", args[0], errno);
+ zwarnnam(nam, "failed to open %s for %sing: %e", args[0],
+ readlock ? "read" : "writ", errno);
return 1;
}
flock_fd = movefd(flock_fd);