Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 27 May 2001 23:26:45 -0400
From:      Mike Heffner <mheffner@cowpie.acm.vt.edu>
To:        freebsd-audit@freebsd.org
Subject:   biff(1) patch
Message-ID:  <20010527232645.A85851@cowpie.acm.vt.edu>

next in thread | raw e-mail | index | archive | help
Use S_IXUSR instead of direct bitmask, BDECFLAGS cleanup.
Please review.

Index: biff.c
===================================================================
RCS file: /home/ncvs/src/usr.bin/biff/biff.c,v
retrieving revision 1.7
diff -u -r1.7 biff.c
--- biff.c	2000/07/10 08:40:14	1.7
+++ biff.c	2001/05/26 20:17:12
@@ -52,6 +52,7 @@
 #include <string.h>
 #include <err.h>
 
+int main __P((int, char *[]));
 static void usage __P((void));
 
 int
@@ -80,23 +81,23 @@
 		err(2, "stat");
 
 	if (*argv == NULL) {
-		(void)printf("is %s\n", sb.st_mode&0100 ? "y" : "n");
-		return(sb.st_mode & 0100 ? 0 : 1);
+		(void)printf("is %s\n", sb.st_mode & S_IXUSR ? "y" : "n");
+		return(sb.st_mode & S_IXUSR ? 0 : 1);
 	}
 
 	switch(argv[0][0]) {
 	case 'n':
-		if (chmod(name, sb.st_mode & ~0100) < 0)
+		if (chmod(name, sb.st_mode & ~S_IXUSR) < 0)
 			err(2, "%s", name);
 		break;
 	case 'y':
-		if (chmod(name, sb.st_mode | 0100) < 0)
+		if (chmod(name, sb.st_mode | S_IXUSR) < 0)
 			err(2, "%s", name);
 		break;
 	default:
 		usage();
 	}
-	return(sb.st_mode & 0100 ? 0 : 1);
+	return(sb.st_mode & S_IXUSR ? 0 : 1);
 }
 
 static void


Also: http://people.freebsd.org/~mikeh/diffs/biff.diff

Mike

-- 

  Mike Heffner               <mheffner@vt.edu>
  Fredericksburg, VA       <mikeh@FreeBSD.org>
      http://filebox.vt.edu/users/mheffner

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-audit" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010527232645.A85851>