Source-Changes-HG archive

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

[src/trunk]: src/tools/compat Use the first argument of getmode() to modify t...



details:   https://anonhg.NetBSD.org/src/rev/07cc4b6b75c9
branches:  trunk
changeset: 557562:07cc4b6b75c9
user:      simonb <simonb%NetBSD.org@localhost>
date:      Mon Jan 12 02:23:37 2004 +0000

description:
Use the first argument of getmode() to modify the second arg, instead of
just replacing the second arg.  This lets the higher order file type bits
survive.  Fixes problems with the tools version of mknod(8).

diffstat:

 tools/compat/getmode.c |  10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r c1b2035389c1 -r 07cc4b6b75c9 tools/compat/getmode.c
--- a/tools/compat/getmode.c    Mon Jan 12 01:43:54 2004 +0000
+++ b/tools/compat/getmode.c    Mon Jan 12 02:23:37 2004 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: getmode.c,v 1.4 2004/01/08 12:16:09 simonb Exp $       */
+/*     $NetBSD: getmode.c,v 1.5 2004/01/12 02:23:37 simonb Exp $       */
 
 /*-
  * Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -52,6 +52,12 @@
 mode_t
 getmode(const void *mp, mode_t mode)
 {
+       mode_t m; 
 
-       return *((const mode_t *)mp);
+       m = *((const mode_t *)mp);
+
+       mode &= ~ALLPERMS;      /* input mode less RWX permissions */
+       m &= ALLPERMS;          /* new RWX permissions */
+
+       return m | mode;
 }



Home | Main Index | Thread Index | Old Index