- /* Lisp functions for making directory listings.
+/* Lisp functions for making directory listings.
Copyright (C) 1985, 1986, 1992, 1993, 1994 Free Software Foundation, Inc.
This file is part of SXEmacs
static char *
dired_realpath(const char *file)
{
- char *result = xmalloc_atomic(4096);
-
- realpath(file, result);
+ char *result = xmalloc_atomic(4096);
+ if ( realpath(file, result) == NULL ) {
+ xfree(result);
+ result = NULL;
+ }
return result;
}
#endif
* store it to our companion bloom filter
*/
canon_name = CANONICALISE_FILENAME(statnam);
-
- /* now, recycle full name */
- fullname = make_ext_string(
- canon_name, strlen(canon_name), Qfile_name);
+ if (canon_name) {
+ /* now, recycle full name */
+ fullname = make_ext_string(
+ canon_name, strlen(canon_name), Qfile_name);
+ }
fullname = fname_as_directory(fullname);
/* now stat statnam */
*/
canon_name = CANONICALISE_FILENAME(statnam);
- /* now, recycle full name */
- fullname = make_ext_string(
- canon_name, strlen(canon_name),
- Qfile_name);
+ if (canon_name) {
+ /* now, recycle full name */
+ fullname = make_ext_string(
+ canon_name, strlen(canon_name),
+ Qfile_name);
+ }
fullname = fname_as_directory(fullname);
/* now stat statnam */
- With the former variant it is NOT possible to have
the trivial filenames on the result list, since a
match against "^[.]$" would exclude everything, while
- actually it was likely meant to _solely_ exclude "."
+ actually it was likely meant to _solely_ exclude "."
from the result list
- Furthermore, we _MUST_ traverse in preorder,
otherwise there is the possibility that pathnames are
}
#if USE_MATCH_ARG
- if (!NILP(match) && !pathname_matches_p(name, match, bufp)) {
+ if (!NILP(match) && bufp && !pathname_matches_p(name, match, bufp)) {
result_p = 0;
}
#endif
maximal recursion depth, use 0 to emulate old `directory-files'.
Optional argument SYMLINK-IS-FILE specifies whether symlinks
-should be resolved \(which is the default behaviour\) or whether
+should be resolved \(which is the default behaviour\) or whether
they are treated as ordinary files \(non-nil\), in the latter
case symlinks to directories are not recurred.
in case it is a directory. */
value = lstat(fullname, st_addr);
if (S_ISLNK(st_addr->st_mode))
- sxemacs_stat(fullname, st_addr);
+ (void)sxemacs_stat(fullname, st_addr);
#else
value = sxemacs_stat(fullname, st_addr);
#endif
==
XSTRING_CHAR_LENGTH(bestmatch)))
/* If there is more than one exact match aside from
- case, and one of them is exact including case,
- prefer that one. */
+ case, and one of them is exact including case,
+ prefer that one. */
&& 0 > scmp_1(p2,
XSTRING_DATA(file),
file_name_length, 0)