[comp.os.minix] Bugs in commands/pr.c commands/date.c lib/strncpy.c

bds@lzaz.ATT.COM (B.SZABLAK) (11/07/88)

Following are some diffs for fixes to the sources delivered with the
ATARI ST release of MINIX. They probably apply to the IBM PC releases
as well:

commands/date.c:
88a89
>   days_per_month[1]=28;

This fixes the problem with setting the date (particularly after having
set it once already).

commands/pr.c:
148a149,150
> 		int line, col;
> 
155a158,160
> 		for(line=0; line < length; line++)
> 			for(col=0; col < columns; col++)
> 				L_BUF(line, col) = NIL_PTR; 

This initializes the malloc array so that selecting the column option
doesn't clobber the command.

lib/strncpy.c:
13c13
<   *s1 = 0;
---
>   while (--n >= 0) *s1++ = 0;

Strncpy() was simply wrong going by the documentation at my disposal; it
always null terminated the string even when the length was too short,
and didn't fill the uncopied part with nulls when the length was too long.

ast@cs.vu.nl (Andy Tanenbaum) (11/09/88)

In article <259@lzaz.ATT.COM> bds@lzaz.ATT.COM (B.SZABLAK) writes:
>Following are some diffs for fixes to the sources delivered with the
>ATARI ST release of MINIX. They probably apply to the IBM PC releases
>as well:

I would strongly urge everyone who posts fixes to do two things:
 1. Post fixes as *.cdif listings against 1.3, i.e.
      cdiff 1.3_file.c newfile.c | USENET

 2. Post one item per message with a subject line that describes the
    message, e.g.  
      Subject: Bug in pr.c and proposed fix

This makes it MUCH easier for people to retrieve things from the archives
later.  If you must post multiple fixes in one message, please shar them
and post the shar file so that people can split them up mechanically using
sh.  The posting cited above scored low on point 1 and moderate on point 2.

Thank you for your help.

Andy Tanenbaum (ast@cs.vu.nl)