[comp.os.minix] dosread bugs

hgm@beta.UUCP (05/06/87)

"dosread" is linked to dosdir and doswrite. I have found two bugs in it.
One is that it allows dos file names up to 11 (not 12) characters long.
The other is that in doswrite, it sets the date wrong.

The enclosed diffs can be used with the latest version of patch.

Move your original dosread source to a system having the latest "patch".
After having cut out the diffs below into a file called dosread.fixes,
run "patch -l dosread.c <dosread.fixes" to get a fixed version.

I make not claims about the suitability of these changes for anything,
but hopefully you will find them useful.




---------------------------Cut here-------------------------------------
*** dosread.c	Wed May  6 09:39:56 1987
--- dosread.new	Wed May  6 09:39:33 1987
***************
*** 276,282 ****
  	int i = 0;
  
  	if (function == FIND) {
! 		while (*pathname != '/' && *pathname && i < 11)
  			file_name[i++] = *pathname++;
  		while (*pathname != '/' && *pathname)
  			pathname++;
--- 276,283 ----
  	int i = 0;
  
  	if (function == FIND) {
! /*		while (*pathname != '/' && *pathname && i < 11) */
! 		while (*pathname != '/' && *pathname && i < 12)
  			file_name[i++] = *pathname++;
  		while (*pathname != '/' && *pathname)
  			pathname++;
***************
*** 581,587 ****
  	i = 0;
  	while (day >= mon_len[i]) {
  		month++;
! 		day -= mon_len[i];
  	}
  	day++;
  
--- 582,589 ----
  	i = 0;
  	while (day >= mon_len[i]) {
  		month++;
! /*		day -= mon_len[i];	*/
! 		day -= mon_len[i++];
  	}
  	day++;
  
-----------------------------Cut here---------------------------------

Harry McGavran
hgm@LANL.GOV
Los Alamos National Laboratory
MS-B294, Group C-8
Los Alamos, New Mexico 87545
505/667-4050