johnc@rtmvax.UUCP (John Connin) (06/15/88)
As requested by AST, I believe the following two I items are not version 1.3 features: (1). fopen(3) when opened in the append mode does not set the the control flag to 'WRITEMODE', the result is the file is not written to as expected. switch(*mode){ case 'w': flags |= WRITEMODE; if (( fd = creat (name,PMODE)) < 0) return(NULL); break; case 'a': /* ?? NO flag set ?? */ if (( fd = open(name,1)) < 0 ) if(errno != ENOENT || (fd = creat(name, PMODE)) < 0) return(NULL); lseek(fd,0L,2); break; case 'r': flags |= READMODE; if (( fd = open (name,0)) < 0 ) return(NULL); break; default: return(NULL); } (2). Though this is not a bug, in getenv)3) it might be prudent to test the validity of 'name' before accessing the environment. #define NULL (char *) 0 char *getenv(name) register char *name; { extern char **environ; register char **v = environ, *p, *q; if (v && name) { /* added if statement */ while ((p = *v++) != NULL) { /* was, while((p = *v) != NULL */ q = name; while (*p++ == *q) if (*q++ == 0) continue; if (*(p - 1) != '=') continue; return(p); } } return(0); } ---- John Connin: RTmVax Semi-Public UNIX/USENET System Orlando, Florida UUCP: {cbosgd!codas,uiucuxc,hoptoad,petsd}!peora!rtmvax!johnc or: {moss,mtune}!codas!rtmvax!johnc c/o: 105 Red Cedar, Longwood, FL., 32779, (407) 869-0567