Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/dist/file/src * be consistent in writable/executable probing



details:   https://anonhg.NetBSD.org/src/rev/db8708908ee2
branches:  trunk
changeset: 559749:db8708908ee2
user:      pooka <pooka%NetBSD.org@localhost>
date:      Tue Mar 23 08:58:47 2004 +0000

description:
* be consistent in writable/executable probing
* use stat info properly when checking for regular file

diffstat:

 dist/file/src/magic.c |  8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diffs (34 lines):

diff -r 6cf2bc66a9c9 -r db8708908ee2 dist/file/src/magic.c
--- a/dist/file/src/magic.c     Tue Mar 23 08:46:57 2004 +0000
+++ b/dist/file/src/magic.c     Tue Mar 23 08:58:47 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: magic.c,v 1.7 2004/03/23 08:40:12 pooka Exp $  */
+/*     $NetBSD: magic.c,v 1.8 2004/03/23 08:58:47 pooka Exp $  */
 
 /*
  * Copyright (c) Christos Zoulas 2003.
@@ -70,7 +70,7 @@
 #if 0
 FILE_RCSID("@(#)Id: magic.c,v 1.19 2004/03/22 20:37:13 christos Exp")
 #else
-__RCSID("$NetBSD: magic.c,v 1.7 2004/03/23 08:40:12 pooka Exp $");
+__RCSID("$NetBSD: magic.c,v 1.8 2004/03/23 08:58:47 pooka Exp $");
 #endif
 #endif /* lint */
 
@@ -240,13 +240,13 @@
                fd = STDIN_FILENO;
        else if ((fd = open(inname, O_RDONLY)) < 0) {
                /* We cannot open it, but we were able to stat it. */
-               if (sb.st_mode & 0002)
+               if (sb.st_mode & 0222)
                        if (file_printf(ms, "writable, ") == -1)
                                return NULL;
                if (sb.st_mode & 0111)
                        if (file_printf(ms, "executable, ") == -1)
                                return NULL;
-               if (sb.st_mode & 0100000)
+               if (S_ISREG(sb.st_mode))
                        if (file_printf(ms, "regular file, ") == -1)
                                return NULL;
                if (file_printf(ms, "no read permission") == -1)



Home | Main Index | Thread Index | Old Index