Deleted Added
full compact
rename.c (25839) rename.c (81404)
1/* rename.c -- BSD compatible directory function for System V
2 Copyright (C) 1988, 1990 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8

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

32{
33 struct stat from_stats;
34 int pid, status;
35
36 if (stat (from, &from_stats) == 0)
37 {
38 /* We don't check existence_error because the systems which need it
39 have rename(). */
1/* rename.c -- BSD compatible directory function for System V
2 Copyright (C) 1988, 1990 Free Software Foundation, Inc.
3
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2, or (at your option)
7 any later version.
8

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

32{
33 struct stat from_stats;
34 int pid, status;
35
36 if (stat (from, &from_stats) == 0)
37 {
38 /* We don't check existence_error because the systems which need it
39 have rename(). */
40 if (unlink (to) && errno != ENOENT)
40 if (CVS_UNLINK (to) && errno != ENOENT)
41 return -1;
42 if ((from_stats.st_mode & S_IFMT) == S_IFDIR)
43 {
44#ifdef MVDIR
45 /* I don't think MVDIR ever gets defined, but I don't think
46 it matters, because I don't think CVS ever calls rename()
47 on directories. */
48

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

67#else /* no MVDIR */
68 error (1, 0, "internal error: cannot move directories");
69#endif /* no MVDIR */
70 }
71 else
72 {
73 /* We don't check existence_error because the systems which need it
74 have rename(). */
41 return -1;
42 if ((from_stats.st_mode & S_IFMT) == S_IFDIR)
43 {
44#ifdef MVDIR
45 /* I don't think MVDIR ever gets defined, but I don't think
46 it matters, because I don't think CVS ever calls rename()
47 on directories. */
48

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

67#else /* no MVDIR */
68 error (1, 0, "internal error: cannot move directories");
69#endif /* no MVDIR */
70 }
71 else
72 {
73 /* We don't check existence_error because the systems which need it
74 have rename(). */
75 if (link (from, to) == 0 && (unlink (from) == 0 || errno == ENOENT))
75 if (link (from, to) == 0 && (CVS_UNLINK (from) == 0 || errno == ENOENT))
76 return 0;
77 }
78 }
79 return -1;
80}
76 return 0;
77 }
78 }
79 return -1;
80}