Commit 5dff1e2b authored by Philip Carns's avatar Philip Carns

add gzseek calls where appropriate to logutils, so that it is a little more

robust against what order the functions are executed


git-svn-id: https://svn.mcs.anl.gov/repos/darshan/trunk@129 3b7491f3-a168-0410-bf4b-c445ed680a29
parent 93b166d8
......@@ -213,6 +213,9 @@ darshan_fd darshan_log_open(const char *name)
int darshan_log_getjob(darshan_fd file, struct darshan_job *job)
{
int ret;
gzseek(file, 0, SEEK_SET);
ret = gzread(file, job, sizeof(*job));
if (ret < sizeof(*job))
{
......@@ -244,6 +247,11 @@ int darshan_log_getfile(darshan_fd fd, struct darshan_job *job, struct darshan_f
const char* err_string;
struct darshan_file_1_21 file_1_21;
if(gztell(file) < CP_JOB_RECORD_SIZE)
gzseek(file, CP_JOB_RECORD_SIZE, SEEK_SET);
gzseek(file, sizeof(struct darshan_job), SEEK_SET);
/* reset file record, so that diff compares against a zero'd out record
* if file is missing
*/
......@@ -309,6 +317,8 @@ int darshan_log_getexe(darshan_fd fd, char *buf, int *flag)
{
int ret;
gzseek(fd, sizeof(struct darshan_job), SEEK_SET);
ret = gzread(fd, buf, (CP_EXE_LEN + 1));
if (ret < (CP_EXE_LEN + 1))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment