Deleted Added
full compact
hardlink.c (54427) hardlink.c (66525)
1/* This program is free software; you can redistribute it and/or modify
2 it under the terms of the GNU General Public License as published by
3 the Free Software Foundation; either version 2, or (at your option)
4 any later version.
5
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

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

58 if (file)
59 ++file;
60 else
61 file = (char *) filepath;
62
63 /* inodestr contains the hexadecimal representation of an
64 inode, so it requires two bytes of text to represent
65 each byte of the inode number. */
1/* This program is free software; you can redistribute it and/or modify
2 it under the terms of the GNU General Public License as published by
3 the Free Software Foundation; either version 2, or (at your option)
4 any later version.
5
6 This program is distributed in the hope that it will be useful,
7 but WITHOUT ANY WARRANTY; without even the implied warranty of
8 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the

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

58 if (file)
59 ++file;
60 else
61 file = (char *) filepath;
62
63 /* inodestr contains the hexadecimal representation of an
64 inode, so it requires two bytes of text to represent
65 each byte of the inode number. */
66 inodestr = (char *) xmalloc (2*sizeof(ino_t)*sizeof(char) + 1);
66 inodestr = (char *) xmalloc (2*sizeof(ino_t) + 1);
67 if (stat (file, &sb) < 0)
68 {
69 if (existence_error (errno))
70 {
71 /* The file doesn't exist; we may be doing an update on a
72 file that's been removed. A nonexistent file has no
73 link information, so return without changing hardlist. */
74 free (inodestr);

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

80 sprintf (inodestr, "%lx", (unsigned long) sb.st_ino);
81
82 /* Find out if this inode is already in the hardlist, adding
83 a new entry to the list if not. */
84 hp = findnode (hardlist, inodestr);
85 if (hp == NULL)
86 {
87 hp = getnode ();
67 if (stat (file, &sb) < 0)
68 {
69 if (existence_error (errno))
70 {
71 /* The file doesn't exist; we may be doing an update on a
72 file that's been removed. A nonexistent file has no
73 link information, so return without changing hardlist. */
74 free (inodestr);

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

80 sprintf (inodestr, "%lx", (unsigned long) sb.st_ino);
81
82 /* Find out if this inode is already in the hardlist, adding
83 a new entry to the list if not. */
84 hp = findnode (hardlist, inodestr);
85 if (hp == NULL)
86 {
87 hp = getnode ();
88 hp->type = UNKNOWN;
88 hp->type = NT_UNKNOWN;
89 hp->key = inodestr;
90 hp->data = (char *) getlist();
91 hp->delproc = dellist;
92 (void) addnode (hardlist, hp);
93 }
94 else
95 {
96 free (inodestr);
97 }
98
99 p = findnode ((List *) hp->data, filepath);
100 if (p == NULL)
101 {
102 p = getnode();
89 hp->key = inodestr;
90 hp->data = (char *) getlist();
91 hp->delproc = dellist;
92 (void) addnode (hardlist, hp);
93 }
94 else
95 {
96 free (inodestr);
97 }
98
99 p = findnode ((List *) hp->data, filepath);
100 if (p == NULL)
101 {
102 p = getnode();
103 p->type = UNKNOWN;
103 p->type = NT_UNKNOWN;
104 p->key = xstrdup (filepath);
105 p->data = NULL;
106 (void) addnode ((List *) hp->data, p);
107 }
108
109 return p;
110}
111

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

123 {
124 path = xstrdup (file);
125 }
126 else
127 {
128 /* file is a relative pathname; assume it's from the current
129 working directory. */
130 char *dir = xgetwd();
104 p->key = xstrdup (filepath);
105 p->data = NULL;
106 (void) addnode ((List *) hp->data, p);
107 }
108
109 return p;
110}
111

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

123 {
124 path = xstrdup (file);
125 }
126 else
127 {
128 /* file is a relative pathname; assume it's from the current
129 working directory. */
130 char *dir = xgetwd();
131 path = xmalloc (sizeof(char) * (strlen(dir) + strlen(file) + 2));
131 path = xmalloc (strlen(dir) + strlen(file) + 2);
132 sprintf (path, "%s/%s", dir, file);
133 free (dir);
134 }
135
136 n = lookup_file_by_inode (path);
137 if (n == NULL)
138 {
139 /* Something is *really* wrong if the file doesn't exist here;

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

171 return getlist();
172
173 /* Get the full pathname of file (assuming the working directory) */
174 if (file[0] == '/')
175 path = xstrdup (file);
176 else
177 {
178 char *dir = xgetwd();
132 sprintf (path, "%s/%s", dir, file);
133 free (dir);
134 }
135
136 n = lookup_file_by_inode (path);
137 if (n == NULL)
138 {
139 /* Something is *really* wrong if the file doesn't exist here;

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

171 return getlist();
172
173 /* Get the full pathname of file (assuming the working directory) */
174 if (file[0] == '/')
175 path = xstrdup (file);
176 else
177 {
178 char *dir = xgetwd();
179 path = (char *) xmalloc (sizeof(char) *
180 (strlen(dir) + strlen(file) + 2));
179 path = (char *) xmalloc (strlen(dir) + strlen(file) + 2);
181 sprintf (path, "%s/%s", dir, file);
182 free (dir);
183 }
184
185 /* We do an extra lookup_file here just to make sure that there
186 is a node for `path' in the hardlist. If that were not so,
187 comparing the working directory linkage against the repository
188 linkage for a file would always fail. */
189 (void) lookup_file_by_inode (path);
190
191 if (stat (path, &sb) < 0)
192 error (1, errno, "cannot stat %s", file);
193 /* inodestr contains the hexadecimal representation of an
194 inode, so it requires two bytes of text to represent
195 each byte of the inode number. */
180 sprintf (path, "%s/%s", dir, file);
181 free (dir);
182 }
183
184 /* We do an extra lookup_file here just to make sure that there
185 is a node for `path' in the hardlist. If that were not so,
186 comparing the working directory linkage against the repository
187 linkage for a file would always fail. */
188 (void) lookup_file_by_inode (path);
189
190 if (stat (path, &sb) < 0)
191 error (1, errno, "cannot stat %s", file);
192 /* inodestr contains the hexadecimal representation of an
193 inode, so it requires two bytes of text to represent
194 each byte of the inode number. */
196 inodestr = (char *) xmalloc (2*sizeof(ino_t)*sizeof(char) + 1);
195 inodestr = (char *) xmalloc (2*sizeof(ino_t) + 1);
197 sprintf (inodestr, "%lx", (unsigned long) sb.st_ino);
198
199 /* Make sure the files linked to this inode are sorted. */
200 n = findnode (hardlist, inodestr);
201 sortlist ((List *) n->data, fsortcmp);
202
203 free (inodestr);
204 return (List *) n->data;

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

275
276 /* If we have already found a file, don't do anything. */
277 if (*uptodate != NULL)
278 return 0;
279
280 /* Look at this file in the hardlist and see whether the checked_out
281 field is 1, meaning that it has been checked out during this CVS run. */
282 path = (char *)
196 sprintf (inodestr, "%lx", (unsigned long) sb.st_ino);
197
198 /* Make sure the files linked to this inode are sorted. */
199 n = findnode (hardlist, inodestr);
200 sortlist ((List *) n->data, fsortcmp);
201
202 free (inodestr);
203 return (List *) n->data;

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

274
275 /* If we have already found a file, don't do anything. */
276 if (*uptodate != NULL)
277 return 0;
278
279 /* Look at this file in the hardlist and see whether the checked_out
280 field is 1, meaning that it has been checked out during this CVS run. */
281 path = (char *)
283 xmalloc (sizeof(char) * (strlen (dir) + strlen (node->key) + 2));
282 xmalloc (strlen (dir) + strlen (node->key) + 2);
284 sprintf (path, "%s/%s", dir, node->key);
285 link = lookup_file_by_inode (path);
286 free (path);
287 free (dir);
288
289 if (link == NULL)
290 {
291 /* We haven't seen this file -- maybe it hasn't been checked

--- 15 unchanged lines hidden ---
283 sprintf (path, "%s/%s", dir, node->key);
284 link = lookup_file_by_inode (path);
285 free (path);
286 free (dir);
287
288 if (link == NULL)
289 {
290 /* We haven't seen this file -- maybe it hasn't been checked

--- 15 unchanged lines hidden ---