Deleted Added
full compact
mv.c (284916) mv.c (300643)
1/*-
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Ken Smith of The State University of New York at Buffalo.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
42#endif /* not lint */
43#endif
44#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 1989, 1993, 1994
3 * The Regents of the University of California. All rights reserved.
4 *
5 * This code is derived from software contributed to Berkeley by
6 * Ken Smith of The State University of New York at Buffalo.
7 *
8 * Redistribution and use in source and binary forms, with or without

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

37 The Regents of the University of California. All rights reserved.\n";
38#endif /* not lint */
39
40#ifndef lint
41static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
42#endif /* not lint */
43#endif
44#include <sys/cdefs.h>
45__FBSDID("$FreeBSD: head/bin/mv/mv.c 284916 2015-06-28 21:36:00Z jilles $");
45__FBSDID("$FreeBSD: head/bin/mv/mv.c 300643 2016-05-25 02:51:15Z truckman $");
46
47#include <sys/types.h>
48#include <sys/acl.h>
49#include <sys/param.h>
50#include <sys/time.h>
51#include <sys/wait.h>
52#include <sys/stat.h>
53#include <sys/mount.h>

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

281 struct stat tsb;
282
283 if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
284 warn("fastcopy: open() failed (from): %s", from);
285 return (1);
286 }
287 if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) {
288 warnx("malloc(%u) failed", blen);
46
47#include <sys/types.h>
48#include <sys/acl.h>
49#include <sys/param.h>
50#include <sys/time.h>
51#include <sys/wait.h>
52#include <sys/stat.h>
53#include <sys/mount.h>

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

281 struct stat tsb;
282
283 if ((from_fd = open(from, O_RDONLY, 0)) < 0) {
284 warn("fastcopy: open() failed (from): %s", from);
285 return (1);
286 }
287 if (bp == NULL && (bp = malloc((size_t)blen)) == NULL) {
288 warnx("malloc(%u) failed", blen);
289 (void)close(from_fd);
289 return (1);
290 }
291 while ((to_fd =
292 open(to, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY, 0)) < 0) {
293 if (errno == EEXIST && unlink(to) == 0)
294 continue;
295 warn("fastcopy: open() failed (to): %s", to);
296 (void)close(from_fd);

--- 215 unchanged lines hidden ---
290 return (1);
291 }
292 while ((to_fd =
293 open(to, O_CREAT | O_EXCL | O_TRUNC | O_WRONLY, 0)) < 0) {
294 if (errno == EEXIST && unlink(to) == 0)
295 continue;
296 warn("fastcopy: open() failed (to): %s", to);
297 (void)close(from_fd);

--- 215 unchanged lines hidden ---