[Search for users]
[Overall Top Noters]
[List of all Conferences]
[Download this site]
Title: | Volume 4, Take a RISC with ULTRIX |
Notice: | Read 1.*!!!! No OSF/1 questions allowed! |
Moderator: | SSDEVO::ROLLOW |
|
Created: | Wed Jun 05 1991 |
Last Modified: | Thu Jun 05 1997 |
Last Successful Update: | Fri Jun 06 1997 |
Number of topics: | 5478 |
Total number of notes: | 14927 |
5462.0. "fseek issues with Ultrix V4.4" by HYDRA::TALATINIAN () Mon Mar 17 1997 16:41
I am working with a partner who has reported a problem trying to fseek to an
odd byte in a file causing the product to crash. The following example
illustrates the problem. This does work correctly on Digital UNIX. Are there
any known bugs or patches available? Thanks in advance.
/* D Miller 3/5/97 - Changes from 'original' version (i.e. repro attached
to 88698):
1. Had to null-terminate 'val' in read_chars after reading,
else this wouldn't even work on Solaris
2. Added a few simple read tests before testing Write-then-read.
3. Added success message in read code. */
#include <stdio.h>
FILE *fp;
void read_chars();
void write_chars();
main ( argv, argc)
int argc;
char *argv;
{
int loc;
/* Write a file containing 'A' (at byte 0) to 'M' (at byte 12),
then change some letters to numbers */
fp = fopen("/tmp/proof_data", "w+");
/* write values A-Z */
write_chars( 0, "ABCDEFGHIJKLM");
/* Read E */
loc = 'E'-'A';
read_chars( loc, "E");
/* Read F */
loc = 'F'-'A';
read_chars( loc, "F");
/* A->1 */
loc = 0;
read_chars( loc, "A");
write_chars( loc, "1");
read_chars( loc, "1");
/* Add N at end */
loc = 'N'-'A';
write_chars( loc, "N");
read_chars( loc, "N");
/* B->2 */
loc = 'B'-'A';
read_chars( loc, "B");
write_chars( loc, "2");
read_chars( loc, "2");
fprintf(stdout, "*** End of test - v4 ***\n");
fclose(fp);
}
void read_chars( at, expect)
int at; /* Where to read */
char* expect; /* Value expected there */
{
int loc;
int nitems;
int size;
char *val;
/* Note we do a seek before an fread! */
fseek( fp, (long)at, 0);
loc = ftell(fp);
if (loc != at) {
fprintf(stdout, "ERROR in read_chars: Seek to %ld, but at %ld\n",
at, loc);
}
size = strlen(expect);
val = (char*)malloc(size+1);
nitems = fread((char*)(val),size,1,fp);
val[size] = '\0';
if (nitems != 1) {
fprintf(stdout, "ERROR in read_chars: Expected 1 item, but read
%d\n",
nitems);
}
if (strcmp(val, expect)) {
fprintf(stdout, "ERROR in read_chars: Expected '%s', but saw
'%s'\n",
expect, val);
}
else {
fprintf(stdout, "--- Successfully read '%s' at %ld\n",
val, at);
}
}
void write_chars( at, new)
int at; /* Where to write */
char *new; /* Value to write */
{
int loc;
unsigned int val;
int nitems;
int size;
/* Note we do a seek before a fwrite! */
fseek( fp, (long)at, 0);
loc = ftell(fp);
if (loc != at) {
fprintf(stdout, "ERROR in write_chars: Seek to %ld, but at
%ld\n",
at, loc);
}
size = strlen(new);
fprintf(stdout, "--- about to write %d chars at %ld\n", size,loc);
fwrite((char*)new, size, 1, fp);
/* We should be size bytes further in the file */
loc = ftell(fp);
if (loc != (at+size)) {
fprintf(stdout, "ERROR after write_chars: Expected to be at %ld,
but at %ld\n",
at+size, loc);
}
}
T.R | Title | User | Personal Name | Date | Lines |
---|
5462.1 | | NABETH::alan | Dr. File System's Home for Wayward Inodes. | Mon Mar 17 1997 18:28 | 8 |
| I don't know where the ULTRIX patch directory has gotten
to. It wasn't there I thought it was (guru::). If you can
find the V4.5 Release Notes it will have a list of all the
problems that it fixed. That should be on oskits:: some-
where.
Failing either of those, give the CSC a call and failing
that start an IPMT case.
|
5462.2 | patch kit area | RUSURE::MELVIN | Ten Zero, Eleven Zero Zero by Zero 2 | Tue Mar 18 1997 10:06 | 12 |
| > I don't know where the ULTRIX patch directory has gotten
> to. It wasn't there I thought it was (guru::).
The patch area is guru::/usr/guest/patches/risc/v4.4 and
guru::/usr/guest/patches/vax/v4.4.
You should take the README file and see if the problem description there
matches what you are seeing. If not, then it would seem an IPMT case is
needed.
-Joe Melvin
USEG/ULTRIX
|