[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Nmh-workers] fseek(fp, 0, SEEK_CUR)?

From: Tom Lane
Subject: Re: [Nmh-workers] fseek(fp, 0, SEEK_CUR)?
Date: Tue, 15 Jan 2013 15:32:57 -0500

Ken Hornstein <address@hidden> writes:
>> inc.c contains two occurrences of this:
>> fseek (fp, 0L, SEEK_CUR);
>> pos = ftell (fp);
>> Is that fseek() ever necessary?

> Hrm.  According to the man page, a successful call to fseek() clears the
> eof indicator and undoes any ungetc() call.  Not sure we want the latter,
> but maybe they're trying to do the former?  fp is opened using
> fdopen(.., "w+"), so I could see it being at EOF.

If it's opened w+, maybe the point is to be sure the ftell reports the
current EOF rather than wherever we last wrote ourselves.  Is the file
in question likely to be concurrently extended by other processes?

                        regards, tom lane

reply via email to

[Prev in Thread] Current Thread [Next in Thread]