tftp-file.c (7847e04111f2c2b06b36f6d19a46d78814d7836d) tftp-file.c (fdf929ff91d432d17c4d7d0aa0f9995fffe6fa8e)
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 200 unchanged lines hidden (view full) ---

209
210 if (fclose(file) != 0) {
211 tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno));
212 return 1;
213 }
214 return 0;
215}
216
1/*-
2 * SPDX-License-Identifier: BSD-2-Clause-FreeBSD
3 *
4 * Copyright (C) 2008 Edwin Groothuis. All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

--- 200 unchanged lines hidden (view full) ---

209
210 if (fclose(file) != 0) {
211 tftp_log(LOG_ERR, "fclose() failed: %s", strerror(errno));
212 return 1;
213 }
214 return 0;
215}
216
217off_t
218tell_file(void)
219{
220
221 return ftello(file);
222}
223
217int
224int
225seek_file(off_t offset)
226{
227
228 return fseeko(file, offset, SEEK_SET);
229}
230
231int
218read_init(int fd, FILE *f, const char *mode)
219{
220
221 convert_to_net(NULL, 0, 1);
222 if (f == NULL) {
223 file = fdopen(fd, "r");
224 if (file == NULL) {
225 int en = errno;

--- 63 unchanged lines hidden ---
232read_init(int fd, FILE *f, const char *mode)
233{
234
235 convert_to_net(NULL, 0, 1);
236 if (f == NULL) {
237 file = fdopen(fd, "r");
238 if (file == NULL) {
239 int en = errno;

--- 63 unchanged lines hidden ---