Changeset 1418:9d792ba0ff49
- Timestamp:
- 1999-12-29 10:35:00 (9 years ago)
- Author:
- Thomas Roessler <roessler@…>
- Branch:
- HEAD
- Message:
-
Fix the use of link_is_dir() in the file browser. This should fix
the bug reported by John Yates <yates@…> on Dec 07 1999.
(Details noted by Byrial Jensen <byrial@…> on Dec 09 1999.)
- Files:
-
Legend:
- Unmodified
- Added
- Removed
-
|
r1414
|
r1418
|
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | | static int link_is_dir (const char *path) |
| | 125 | static int link_is_dir (const char *folder, const char *path) |
| 126 | 126 | { |
| 127 | 127 | struct stat st; |
| 128 | | |
| 129 | | if (stat (path, &st) == 0) |
| | 128 | char fullpath[_POSIX_PATH_MAX]; |
| | 129 | |
| | 130 | snprintf (fullpath, sizeof (fullpath), "%s/%s", folder, path); |
| | 131 | |
| | 132 | if (stat (fullpath, &st) == 0) |
| 130 | 133 | return (S_ISDIR (st.st_mode)); |
| 131 | 134 | else |
| 132 | | return (-1); |
| | 135 | return 0; |
| 133 | 136 | } |
| 134 | 137 | |
| … |
… |
|
| 493 | 496 | { |
| 494 | 497 | struct folder_file *ff = &(((struct folder_file *)menu->data)[n]); |
| 495 | | if (S_ISDIR (ff->mode) || (S_ISLNK (ff->mode) && link_is_dir (ff->name))) |
| | 498 | if (S_ISDIR (ff->mode) || (S_ISLNK (ff->mode) && link_is_dir (LastDir, ff->name))) |
| 496 | 499 | { |
| 497 | 500 | mutt_error _("Can't attach a directory!"); |
| … |
… |
|
| 619 | 622 | if (S_ISDIR (state.entry[menu->current].mode) || |
| 620 | 623 | (S_ISLNK (state.entry[menu->current].mode) && |
| 621 | | link_is_dir (state.entry[menu->current].name)) |
| | 624 | link_is_dir (LastDir, state.entry[menu->current].name)) |
| 622 | 625 | #ifdef USE_IMAP |
| 623 | 626 | || state.entry[menu->current].notfolder |
| … |
… |
|
| 844 | 847 | if (!state.imap_browse) |
| 845 | 848 | #endif |
| 846 | | {/* add '/' at the end of the directory name */ |
| 847 | | int len=mutt_strlen(LastDir); |
| 848 | | if (sizeof (buf) > len) |
| 849 | | buf[len]='/'; |
| | 849 | { |
| | 850 | /* add '/' at the end of the directory name */ |
| | 851 | int len=mutt_strlen(LastDir); |
| | 852 | if (sizeof (buf) > len) |
| | 853 | buf[len]='/'; |
| 850 | 854 | } |
| 851 | 855 | |
| … |
… |
|
| 1058 | 1062 | if (S_ISDIR (state.entry[menu->current].mode) || |
| 1059 | 1063 | (S_ISLNK (state.entry[menu->current].mode) && |
| 1060 | | link_is_dir (state.entry[menu->current].name))) |
| | 1064 | link_is_dir (LastDir, state.entry[menu->current].name))) |
| 1061 | 1065 | { |
| 1062 | 1066 | mutt_error _("Can't view a directory"); |