From: Eric Backus Subject: Patch1 for libc.a To: djgpp AT sun DOT soe DOT clarkson DOT edu (djgpp) Date: Mon, 24 Aug 92 14:27:17 PDT Mailer: Elm [revision: 66.25] Fixes for stat() for djgpp 1.08 ------------------------------- 1. Directories have the S_IWRITE bit set, because on DOS, files can be added/deleted from any directory. 2. The st_uid and st_gid fields are set to be equal to the user and group ids as given by getuid() and getgid(), so that all files appear to be owned by the caller. 3. The st_dev field is set to the drive number that the file is found on. 4. The st_ino field returns the same value for two different calls to stat() with the same file, and returns different values for different files. This allows programs like "mv" or "cp" to detect if they are about to overwrite an input file. The root directory is statable (looks like this was already added between 1.07 and 1.08 but I'll leave my modification anyway). 5. There is some strange bug in stat() which causes the wrong value to get used for st_atime, st_mtime, and st_ctime if time() has not been previously called, which has been worked around. To get a fixed version of stat(), remove the existing /djgpp/libsrc/c/sys/stat.s and replace it with the stat.c and stat_ast.s supplied below. Fixes for opendir(), readdir(), and closedir() for djgpp 1.08 ------------------------------------------------------------- 1. As written, opendir() appends "/*.*" to the end of the path passed to it, even if that path already ends in a slash. This can cause the opendir() to fail. I now strip trailing slashes from the supplied path. 2. As written, readdir() skips hidden and system files. I personally don't like that, and it makes programs like "du" get the wrong answer. I've modified readdir() to pick up all files. 3. As written, closedir() does not return a value like it's supposed to. I've modified it to return zero. To get a fixed version of these functions, apply the patch supplied below to /djgpp/libsrc/c/dos/dir.c. Fix for umask() for djgpp 1.08 ------------------------------ 1. As written, umask() returns 0644, which is the inverse of what it should return. I've modified it to return 022, a more reasonable value. To get a fixed version of umask(), replace /djgpp/libsrc/c/sys/umask.c with the umask.c supplied below. Fix for strftime() for djgpp 1.08 --------------------------------- 1. For some reason, the existing strftime() has the "%Z" case #ifdef'ed out. The commented out code works, and is needed for a program like "date" to correctly print the timezone in the date string. I've removed the #if around "%Z". To get a fixed version of strftime(), apply the patch supplied below to /djgpp/libsrc/c/str/strftime.c. Fix for errno.h for djgpp 1.08 ------------------------------ 1. The existing errno.h has EBADENV and E2BIG set to different values. On unix, EBADENV does not exist and E2BIG is used for both "arg list too long" and "environment too big". So I changed E2BIG to be equal to EBADENV. 2. The existing errno.h has EXDEV ("cross-device link attempted") equal to 22. However, DOS returns 17 for this situation, so EXDEV should be equal to 17. 3. The existing errno.h does not have EPERM, which is used by several GNU programs. I set EPERM equal to EACCES. To get a fixed version of errno.h, apply the patch supplied below to /djgpp/include/errno.h. begin 644 patch1.zoo M6D]/(#(N,3`@07)C:&EV92X:``#*+`())(;CSSRPMZ5KH2<9._6(8%>8H<.+![:P1..+ M7$CL$(8JM AT 2 DOT PQA2#UP*Q3.>]R"]QAS!N78IZD<[BSST2MTU)G,AM>XYRQN8 MV#U:DNW\-\"SH9OX[G*%>`7R#34D^T5)*>VZYZ`%;[]VUTFGI-6,\8"_2Z.;Z> M%J\J>5T"LJVDU7>E"X'Q_VX\"K=15W(K=NJA"[;S'1J0;[U-^MC9FFL9[(,] M7[$S'33YP'O*NCHR?3)HY^G+7_A]0MII@[TBA:'3U96I9R9M;Z^`0%P``#40N"Q-:RVFG/QRMPR*N MV&,?!OBIWN?(W11(TU&VVP(A!CU7CH*UU(*$-E(">7]A%!A_CH/00"XG''+8 M>]5\0F#GMA&]OF9P%R_M\0;,P!QT$TE,0!R2XQYP![`'OZ^V$AP39/4%!-99 MR;=X&[_L"1R9X>Q8)!<"1FUS5EH"9%-FHAE;P3]>@(+%'UKU!.W`D**0K*E0 M*.<*SFIX43)*/0.)B(;P0?^).&DZ-4RF)^='"B=&Q$@$*X$B0=*7/-$:RF\. M%$Y8\HVGQ--+ELLO]BW;V.7(R;??N(\DRJOI+[2-G`"URUX7/QRQXH<8Y,__ MT[ZW;@M[3L>I>9??K>]4==V4E&92T%L\5$H!/DE1-03S5 MUM;G8E7(/6R%^4%IIWGL-0FU06F1O)ZWD/-D:'#%$/M6",!RFGKLH('0E5%Z MKIX@``#\^ M\NT`:N-M/7+<8!:ED#UIS:%(Q8V!P^?S\08,*CGGT"K"=-&(#+!AI*Q2*,7=\R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S:%OQ3\6OH97&IY[_O]OL]_,' M87CS/TYO?\^5WER_7E]=A;J)T49'@#@CI1,*'$)6T36I+%&*"C%VJ% M.E.R8;%A8Y7%+J1&:+/8CR^*.7Q1X)\CVCYN'B?4-D*-2I45_'5,<8.LXVGO MS<5<'5^R]40+7C,?H\A MFITQ@```W*?$_0("40L``)X)```8&<5Q<,[+`@``LP$```(!``````````!S M=&%T7V%S="YS````"@`NN5H;6U2.K*\53<;ECPY'4VY*3QR^X;&,)'"'LR^T.7)DY0Z_J'6E;&J3B# MFYP^RFN>FP"7#GF914DE`6 MV(&2?4D!FJW`L=L=95F&FAE%M:;'P!?`$`E9KX%X!?3 AT OBIXG7BMN2TYGJK_U8 MR__E/OT%SZMA0)IVAWDFF)I+MZ?T=3R;7JGS>5(]S$*I$E"O[P![PS-50'4:C[VN&,QQQQ2O3^'CZWK8=8;G/,_<9SAL:/TR?2.*MEQXO M5T8O69<<7A7PB?:T[/*,``#@*6L>MF*J]I1[+P!HCIN[J&_KOJTIH M$R;GE^G]K?QK%#QX&ZVZ^^3]#EES5L=K\B$9?]+4S(1Q])93+UX?R7]]4OP) MILZ(9(\=F```W*?$_0(":0T``)X,```8&<5Q<3TI`0``RP````(!```````` M``!U;6%S:RYC`"YD:68`"@`<9-T`````I`%`````0"DC*```UEJ6L<:A6//` M'^(M*6I2C AT N4X-PE!Q=.[>Z:O23C9O6"(^-VRBB,@`2-'CN'I$Q14S29:#'W MSUU&TBK\#+:>#)284VV6=1X>//GO%HIA$)4-$X`!)]36KP>3_1,+&^@6FGR+ M%-N`>@?,G2W]#\N7[#2,IUO"M?:R30Z AT E,8/!,>(LC1?;%E1C&IK)*UN)Y44 M9K3;5SL4<*7?>&_QQ]=9.I]2TV/MH$/7IY^PD6$4F?`;N,$FT.S=W/Q$J8GW MP^KQ/X6W+/*'W````-RGQ/T"```````````````````````````````````` 8`````````````````````````````/R# ` end -- Eric Backus ericb%hplsla AT hplabs DOT hp DOT com (206) 335-2495