[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [MiNT] umask fixes for MiNTlib
On Wed, 2008-06-18 at 20:05 +0100, Alan Hourihane wrote:
> On Wed, 2008-06-18 at 19:46 +0100, Alan Hourihane wrote:
> > Attached is a patch against MiNTlib which deals with some int/uint
> > problems with umask.
> >
> > mode_t is defined as a uint, but Pumask() is returning an int. So
> > there's some casting that has to be done.
> >
> > This patch does just that.
>
> Actually, thinking about this a little more, it's probably better is
> __current_umask is not a mode_t, but an int instead.
>
> Let me send an updated patch.
Attached.
Alan.
Index: unix/open.c
===================================================================
RCS file: /mint/mintlib/unix/open.c,v
retrieving revision 1.6
diff -u -r1.6 open.c
--- unix/open.c 6 Dec 2005 19:28:07 -0000 1.6
+++ unix/open.c 18 Jun 2008 19:10:26 -0000
@@ -26,7 +26,7 @@
* but adjust the file masks here.
*/
-mode_t __current_umask = -1;
+int __current_umask = -1;
/* Try to open the file NAME with FLAGS. If the OS returns EACCES check
if we are the super-user and then try to temporarily change the
Index: mintlib/lib.h
===================================================================
RCS file: /mint/mintlib/mintlib/lib.h,v
retrieving revision 1.12
diff -u -r1.12 lib.h
index dc7e869..86a070a 100644
--- mintlib/lib.h
+++ mintlib/lib.h
@@ -69,7 +69,7 @@ extern long _sigpending;
/* unix/open.c */
-extern mode_t __current_umask;
+extern int __current_umask;
/* definitions needed in malloc.c and realloc.c */
Index: mintlib/getumask.c
===================================================================
RCS file: /mint/mintlib/mintlib/getumask.c,v
retrieving revision 1.3
diff -u -r1.3 getumask.c
--- mintlib/getumask.c 8 Oct 2003 15:23:14 -0000 1.3
+++ mintlib/getumask.c 18 Jun 2008 19:10:26 -0000
@@ -16,7 +16,7 @@
__getumask (void)
{
/* The only possible failure for Pumask is ENOSYS. */
- mode_t old_umask = Pumask (0);
+ int old_umask = Pumask (0);
if (old_umask >= 0)
(void) Pumask (old_umask);
Index: misc/setmode.c
===================================================================
RCS file: /mint/mintlib/misc/setmode.c,v
retrieving revision 1.1
diff -u -r1.1 setmode.c
--- misc/setmode.c 2 Jul 2003 21:55:10 -0000 1.1
+++ misc/setmode.c 18 Jun 2008 19:10:26 -0000
@@ -72,7 +72,7 @@
#define CMD2_OBITS 0x08
#define CMD2_UBITS 0x10
-static BITCMD *addcmd __P((BITCMD *, int, int, int, u_int));
+static BITCMD *addcmd __P((BITCMD *, int, u_int, int, u_int));
static void compress_mode __P((BITCMD *));
#ifdef SETMODE_DEBUG
static void dumpmode __P((BITCMD *));
@@ -178,11 +178,12 @@
setmode(p)
const char *p;
{
- int perm, who;
+ int perm;
+ unsigned int who;
char op, *ep;
BITCMD *set, *saveset, *endset;
sigset_t sigset, sigoset;
- mode_t mask;
+ int mask;
int equalopdone = 0; /* pacify gcc */
int permXbits, setlen;
@@ -350,7 +351,8 @@
static BITCMD *
addcmd(set, op, who, oparg, mask)
BITCMD *set;
- int oparg, who;
+ int oparg;
+ u_int who;
int op;
u_int mask;
{