I happened to be looking at this (enabling it as a host build tool for
Android kernel builds) and I had plenty of time waiting for the Android
build system to warm up to switch this over to FLAG(). Sad but true.
---
 toys/other/flock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
From b9eb8d76d17c12fbeb5ad2ce1c168957c843312b Mon Sep 17 00:00:00 2001
From: Elliott Hughes <e...@google.com>
Date: Wed, 28 Jun 2023 09:48:01 -0700
Subject: [PATCH] flock: use FLAG().

I happened to be looking at this (enabling it as a host build tool for
Android kernel builds) and I had plenty of time waiting for the Android
build system to warm up to switch this over to FLAG(). Sad but true.
---
 toys/other/flock.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/toys/other/flock.c b/toys/other/flock.c
index 3dc75870..150ddc60 100644
--- a/toys/other/flock.c
+++ b/toys/other/flock.c
@@ -27,10 +27,10 @@ void flock_main(void)
 {
   int fd = xstrtol(*toys.optargs, NULL, 10), op;
 
-  if (toys.optflags & FLAG_u) op = LOCK_UN;
-  else op = (toys.optflags & FLAG_s) ? LOCK_SH : LOCK_EX;
+  if (FLAG(u)) op = LOCK_UN;
+  else op = FLAG(s) ? LOCK_SH : LOCK_EX;
 
-  if (toys.optflags & FLAG_n) op |= LOCK_NB;
+  if (FLAG(n)) op |= LOCK_NB;
 
   if (flock(fd, op)) {
     if ((op & LOCK_NB) && errno == EAGAIN) toys.exitval = 1;
-- 
2.41.0.255.g8b1d071c50-goog

_______________________________________________
Toybox mailing list
Toybox@lists.landley.net
http://lists.landley.net/listinfo.cgi/toybox-landley.net

Reply via email to