shithub: drawterm

Download patch

ref: 3b5a50f3bf1570e2b1ee329be64762cf1fc8a8f0
parent: 68e61c65494f36f4b35981914016276c62e2c574
author: Sigrid Solveig Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sat Apr 2 07:35:03 EDT 2022

devcmd: fix perm "no-change" comparison on wstat

Since ulong is 32 bits in 64-bit builds, this would always result in changing perm:

devcmd.c:573:14: warning: result of comparison of constant 18446744073709551615 with expression of type 'p9_ulong' (aka 'unsigned int') is always true[-Wtautological-constant-out-of-range-compare]
                if(d->mode != ~0UL)

Cast to ulong, so even if it becomes 64 bits, it should still work.

--- a/kern/devcmd.c
+++ b/kern/devcmd.c
@@ -570,7 +570,7 @@
 			error(Eperm);
 		if(!emptystr(d->uid))
 			kstrdup(&cv->owner, d->uid);
-		if(d->mode != ~0UL)
+		if(d->mode != (ulong)~0UL)
 			cv->perm = d->mode & 0777;
 		poperror();
 		free(d);