fix permissions when converting from DOS-type filesystem

This commit is contained in:
brad 1999-04-20 21:38:23 +00:00
parent 5ac3448778
commit 2123f33591

View File

@ -0,0 +1,77 @@
*** os.c.orig Sat Apr 17 18:53:01 1999
--- os.c Tue Apr 20 04:45:20 1999
***************
*** 82,88 ****
--- 82,91 ----
SetConsoleMode(hConIn,ConInMode);
SetConsoleMode(hConOut,ConOutMode);
#else
+ char *s;
fgets(Str,sizeof(Password)-1,stdin);
+ if ((s = strchr(Str, '\n')) != NULL)
+ *s = '\0';
#endif
}
***************
*** 408,433 ****
}
#endif
#ifdef _UNIX
switch(NewLhd.HostOS)
{
case MS_DOS:
case OS2:
case WIN_32:
if (NewLhd.FileAttr & 0x10)
! NewLhd.FileAttr=0x41ff;
else
if (NewLhd.FileAttr & 1)
! NewLhd.FileAttr=0x816d;
else
! NewLhd.FileAttr=0x81ff;
break;
case UNIX:
break;
default:
if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY)
! NewLhd.FileAttr=0x41ff;
else
! NewLhd.FileAttr=0x81ff;
break;
}
#endif
--- 411,443 ----
}
#endif
#ifdef _UNIX
+ static mode_t mask = -1;
+
+ if (mask == (mode_t) -1)
+ {
+ mask = umask(022);
+ (void) umask(mask);
+ }
switch(NewLhd.HostOS)
{
case MS_DOS:
case OS2:
case WIN_32:
if (NewLhd.FileAttr & 0x10)
! NewLhd.FileAttr=0x41ff & ~mask;
else
if (NewLhd.FileAttr & 1)
! NewLhd.FileAttr=0x8124 & ~mask;
else
! NewLhd.FileAttr=0x81b6 & ~mask;
break;
case UNIX:
break;
default:
if ((NewLhd.Flags & LHD_WINDOWMASK)==LHD_DIRECTORY)
! NewLhd.FileAttr=0x41ff & ~mask;
else
! NewLhd.FileAttr=0x81b6 & ~mask;
break;
}
#endif