summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlan Coopersmith <alan.coopersmith@oracle.com>2024-01-21 09:33:06 -0800
committerAlan Coopersmith <alan.coopersmith@oracle.com>2024-01-21 09:34:22 -0800
commitee1d1c10f4c966b39689d0fe0e602cabb47d72e8 (patch)
tree27ce1dc725a43b6bf9be45f881fc15ab625e96f0
parent58686e938a099bd6e3f4fb491dea9382a50febdb (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.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/xpr.c b/xpr.c
index 86cf107..4bece2b 100644
--- a/xpr.c
+++ b/xpr.c
@@ -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);