Don't seek fd if no -S <offset> was specified

This commit is contained in:
Joseph C. Lehner 2024-10-02 15:18:01 +02:00
parent 904479bc1a
commit ab3d77418c

2
tftp.c
View file

@ -359,7 +359,7 @@ ssize_t tftp_put(struct nmrpd_args *args)
file_remote = args->file_local;
}
if (lseek(fd, args->offset, SEEK_SET) == (off_t)-1) {
if (args->offset && (lseek(fd, args->offset, SEEK_SET) == (off_t)-1)) {
xperror("lseek");
goto cleanup;
}