VirtualBox

Changeset 1222 in kBuild for trunk/src/kash/setmode.c


Ignore:
Timestamp:
Oct 8, 2007 12:24:31 AM (17 years ago)
Author:
bird
Message:

more fixes - it all compiles now (linking fails of course).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/kash/setmode.c

    r1221 r1222  
    3333 */
    3434
    35 /*#include <sys/cdefs.h>*/
     35#if 0
    3636#if defined(LIBC_SCCS) && !defined(lint)
    37 #if 0
    3837static char sccsid[] = "@(#)setmode.c   8.2 (Berkeley) 3/25/94";
    3938#else
    4039__RCSID("$NetBSD: setmode.c,v 1.30 2003/08/07 16:42:56 agc Exp $");
    41 #endif
    4240#endif /* LIBC_SCCS and not lint */
    43 
    44 /*#include "namespace.h"*/
     41#endif
     42
    4543#include <sys/types.h>
    4644#include <sys/stat.h>
     
    4947#include <ctype.h>
    5048#include <errno.h>
    51 #include <signal.h>
    5249#include <stdlib.h>
    5350#include "shinstance.h" /* for unistd.h types/defines */
     
    5653#include <stdio.h>
    5754#endif
    58 
    59 /*#ifdef __weak_alias
    60 __weak_alias(getmode,_getmode)
    61 __weak_alias(setmode,_setmode)
    62 #endif*/
    6355
    6456#define SET_LEN 6               /* initial # of bitcmd struct to malloc */
     
    7769#define CMD2_UBITS      0x10
    7870
    79 static BITCMD   *addcmd(BITCMD *, int, int, int, u_int);
     71static BITCMD   *addcmd(BITCMD *, int, int, int, unsigned int);
    8072static void      compress_mode(BITCMD *);
    8173#ifdef SETMODE_DEBUG
     
    190182
    191183void *
    192 bsd_setmode(const char *p)
     184bsd_setmode(shinstance *psh, const char *p)
    193185{
    194186        int perm, who;
    195187        char op, *ep;
    196188        BITCMD *set, *saveset, *endset;
    197 #ifndef _MSC_VER
    198         sigset_t signset, sigoset;
    199 #endif
    200189        mode_t mask;
    201190        int equalopdone = 0;    /* pacify gcc */
     
    207196        /*
    208197         * 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.
    212199         */
    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);
    222201
    223202        setlen = SET_LEN + 2;
    224203
    225         if ((set = malloc((u_int)(sizeof(BITCMD) * setlen))) == NULL)
     204        if ((set = malloc(sizeof(BITCMD) * setlen)) == NULL)
    226205                return (NULL);
    227206        saveset = set;
     
    372351        int oparg, who;
    373352        int op;
    374         u_int mask;
     353        unsigned int mask;
    375354{
    376355
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette