Changeset 1222 in kBuild for trunk/src/kash/setmode.c
- Timestamp:
- Oct 8, 2007 12:24:31 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kash/setmode.c
r1221 r1222 33 33 */ 34 34 35 /*#include <sys/cdefs.h>*/ 35 #if 0 36 36 #if defined(LIBC_SCCS) && !defined(lint) 37 #if 038 37 static char sccsid[] = "@(#)setmode.c 8.2 (Berkeley) 3/25/94"; 39 38 #else 40 39 __RCSID("$NetBSD: setmode.c,v 1.30 2003/08/07 16:42:56 agc Exp $"); 41 #endif42 40 #endif /* LIBC_SCCS and not lint */ 43 44 /*#include "namespace.h"*/ 41 #endif 42 45 43 #include <sys/types.h> 46 44 #include <sys/stat.h> … … 49 47 #include <ctype.h> 50 48 #include <errno.h> 51 #include <signal.h>52 49 #include <stdlib.h> 53 50 #include "shinstance.h" /* for unistd.h types/defines */ … … 56 53 #include <stdio.h> 57 54 #endif 58 59 /*#ifdef __weak_alias60 __weak_alias(getmode,_getmode)61 __weak_alias(setmode,_setmode)62 #endif*/63 55 64 56 #define SET_LEN 6 /* initial # of bitcmd struct to malloc */ … … 77 69 #define CMD2_UBITS 0x10 78 70 79 static BITCMD *addcmd(BITCMD *, int, int, int, u _int);71 static BITCMD *addcmd(BITCMD *, int, int, int, unsigned int); 80 72 static void compress_mode(BITCMD *); 81 73 #ifdef SETMODE_DEBUG … … 190 182 191 183 void * 192 bsd_setmode( const char *p)184 bsd_setmode(shinstance *psh, const char *p) 193 185 { 194 186 int perm, who; 195 187 char op, *ep; 196 188 BITCMD *set, *saveset, *endset; 197 #ifndef _MSC_VER198 sigset_t signset, sigoset;199 #endif200 189 mode_t mask; 201 190 int equalopdone = 0; /* pacify gcc */ … … 207 196 /* 208 197 * Get a copy of the mask for the permissions that are mask relative. 209 * Flip the bits, we want what's not set. Since it's possible that 210 * the caller is opening files inside a signal handler, protect them 211 * as best we can. 198 * Flip the bits, we want what's not set. 212 199 */ 213 #ifndef _MSC_VER 214 sigfillset(&signset); 215 (void)sigprocmask(SIG_BLOCK, &signset, &sigoset); 216 #endif 217 (void)umask(mask = umask(0)); 218 mask = ~mask; 219 #ifndef _MSC_VER 220 (void)sigprocmask(SIG_SETMASK, &sigoset, NULL); 221 #endif 200 mask = shfile_get_umask(&psh->fdtab); 222 201 223 202 setlen = SET_LEN + 2; 224 203 225 if ((set = malloc( (u_int)(sizeof(BITCMD) * setlen))) == NULL)204 if ((set = malloc(sizeof(BITCMD) * setlen)) == NULL) 226 205 return (NULL); 227 206 saveset = set; … … 372 351 int oparg, who; 373 352 int op; 374 u _int mask;353 unsigned int mask; 375 354 { 376 355
Note:
See TracChangeset
for help on using the changeset viewer.