diff options
author | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-21 09:33:06 -0800 |
---|---|---|
committer | Alan Coopersmith <alan.coopersmith@oracle.com> | 2024-01-21 09:34:22 -0800 |
commit | ee1d1c10f4c966b39689d0fe0e602cabb47d72e8 (patch) | |
tree | 27ce1dc725a43b6bf9be45f881fc15ab625e96f0 | |
parent | 58686e938a099bd6e3f4fb491dea9382a50febdb (diff) |
Modernize lseek() calls
Position should be stored in an off_t, not an int, and use
symbolic constants instead of raw numbers for the "whence" arg.
Signed-off-by: Alan Coopersmith <alan.coopersmith@oracle.com>
-rw-r--r-- | xpr.c | 5 |
1 files changed, 2 insertions, 3 deletions
@@ -555,7 +555,6 @@ void parse_args( { register char *output_filename; register int f; - register int pos; output_filename = NULL; *device = PS; /* default */ @@ -764,12 +763,12 @@ void parse_args( exit(1); } if (*flags & F_APPEND) { - pos = lseek(f, 0, 2); /* get eof position */ + off_t pos = lseek(f, 0, SEEK_END); /* get eof position */ if ((*flags & F_NOFF) && !(*device == LJET || *device == PJET || *device == PJETXL)) pos -= 3; /* set position before trailing */ /* formfeed and reset */ - lseek(f, pos, 0); /* set pointer */ + lseek(f, pos, SEEK_SET); /* set pointer */ } dup2(f, 1); close(f); |