Take into account st_dev. Thanks to Sam.
Showing
1 changed file
with
6 additions
and
3 deletions
... | @@ -30,6 +30,7 @@ struct inode_list | ... | @@ -30,6 +30,7 @@ struct inode_list |
30 | { | 30 | { |
31 | struct inode_list *next; | 31 | struct inode_list *next; |
32 | ino_t inode; | 32 | ino_t inode; |
33 | dev_t dev; | ||
33 | }; | 34 | }; |
34 | 35 | ||
35 | /* | 36 | /* |
... | @@ -168,6 +169,7 @@ imap4d_list (struct imap4d_command *command, char *arg) | ... | @@ -168,6 +169,7 @@ imap4d_list (struct imap4d_command *command, char *arg) |
168 | stat (cwd, &st); | 169 | stat (cwd, &st); |
169 | inode_rec.next = NULL; | 170 | inode_rec.next = NULL; |
170 | inode_rec.inode = st.st_ino; | 171 | inode_rec.inode = st.st_ino; |
172 | inode_rec.dev = st.st_dev; | ||
171 | list_file (cwd, ref, (dir) ? dir : "", delim, &inode_rec); | 173 | list_file (cwd, ref, (dir) ? dir : "", delim, &inode_rec); |
172 | chdir (homedir); | 174 | chdir (homedir); |
173 | } | 175 | } |
... | @@ -179,10 +181,10 @@ imap4d_list (struct imap4d_command *command, char *arg) | ... | @@ -179,10 +181,10 @@ imap4d_list (struct imap4d_command *command, char *arg) |
179 | } | 181 | } |
180 | 182 | ||
181 | static int | 183 | static int |
182 | inode_list_lookup (struct inode_list *list, ino_t inode) | 184 | inode_list_lookup (struct inode_list *list, struct stat *st) |
183 | { | 185 | { |
184 | for (; list; list = list->next) | 186 | for (; list; list = list->next) |
185 | if (list->inode == inode) | 187 | if (list->inode == st->st_ino && list->dev == st->st_dev) |
186 | return 1; | 188 | return 1; |
187 | return 0; | 189 | return 0; |
188 | } | 190 | } |
... | @@ -248,7 +250,7 @@ list_file (const char *cwd, const char *ref, const char *pattern, | ... | @@ -248,7 +250,7 @@ list_file (const char *cwd, const char *ref, const char *pattern, |
248 | print_dir (ref, entry, delim); | 250 | print_dir (ref, entry, delim); |
249 | 251 | ||
250 | if (S_ISDIR (st.st_mode) | 252 | if (S_ISDIR (st.st_mode) |
251 | && inode_list_lookup (inode_list, st.st_ino) == 0) | 253 | && inode_list_lookup (inode_list, &st) == 0) |
252 | { | 254 | { |
253 | if (chdir (entry) == 0) | 255 | if (chdir (entry) == 0) |
254 | { | 256 | { |
... | @@ -257,6 +259,7 @@ list_file (const char *cwd, const char *ref, const char *pattern, | ... | @@ -257,6 +259,7 @@ list_file (const char *cwd, const char *ref, const char *pattern, |
257 | struct inode_list inode_rec; | 259 | struct inode_list inode_rec; |
258 | 260 | ||
259 | inode_rec.inode = st.st_ino; | 261 | inode_rec.inode = st.st_ino; |
262 | inode_rec.dev = st.st_dev; | ||
260 | inode_rec.next = inode_list; | 263 | inode_rec.next = inode_list; |
261 | rf = calloc (strlen (ref) + strlen (delim) + | 264 | rf = calloc (strlen (ref) + strlen (delim) + |
262 | strlen (entry) + 1, 1); | 265 | strlen (entry) + 1, 1); | ... | ... |
-
Please register or sign in to post a comment