--- sourceforge.net/trunk/rdesktop/disk.c 2004/01/21 14:40:40 569 +++ sourceforge.net/trunk/rdesktop/disk.c 2004/01/21 23:53:55 574 @@ -64,14 +64,44 @@ #define MAX_OPEN_FILES 0x100 +#if (defined(sun) && (defined(__svr4__) || defined(__SVR4))) +#define SOLARIS +#endif + +#ifdef SOLARIS +#define DIRFD(a) ((a)->dd_fd) +#else +#define DIRFD(a) (dirfd(a)) +#endif + #include #include -#include /* linux statfs */ #include #include /* open, close */ #include /* opendir, closedir, readdir */ #include #include /* errno */ + +#if defined(SOLARIS) +#include /* solaris statvfs */ +#define STATFS_FN(path, buf) (statvfs(path,buf)) +#define STATFS_T statvfs +#define F_NAMELEN(buf) ((buf).f_namemax) + +#elif defined(__OpenBSD__) +#include +#include +#define STATFS_FN(path, buf) (statfs(path,buf)) +#define STATFS_T statfs +#define F_NAMELEN(buf) (NAME_MAX) + +#else +#include /* linux statfs */ +#define STATFS_FN(path, buf) (statfs(path,buf)) +#define STATFS_T statfs +#define F_NAMELEN(buf) ((buf).f_namelen) +#endif + #include "rdesktop.h" extern RDPDR_DEVICE g_rdpdr_device[]; @@ -116,7 +146,7 @@ pos2 = next_arg(optarg, '='); strcpy(g_rdpdr_device[*id].name, optarg); - toupper(g_rdpdr_device[*id].name); + toupper_str(g_rdpdr_device[*id].name); /* add trailing colon to name. */ strcat(g_rdpdr_device[*id].name, ":"); @@ -212,7 +242,7 @@ return STATUS_NO_SUCH_FILE; } } - handle = dirfd(dirp); + handle = DIRFD(dirp); } else { @@ -476,14 +506,14 @@ disk_query_volume_information(HANDLE handle, uint32 info_class, STREAM out) { char *volume, *fs_type; - struct statfs stat_fs; + struct STATFS_T stat_fs; struct fileinfo *pfinfo; pfinfo = &(g_fileinfo[handle]); volume = "RDESKTOP"; fs_type = "RDPFS"; - if (statfs(pfinfo->path, &stat_fs) != 0) /* FIXME: statfs is not portable */ + if (STATFS_FN(pfinfo->path, &stat_fs) != 0) /* FIXME: statfs is not portable */ { perror("statfs"); return STATUS_ACCESS_DENIED; @@ -514,7 +544,7 @@ case 5: /* FileFsAttributeInformation */ out_uint32_le(out, FS_CASE_SENSITIVE | FS_CASE_IS_PRESERVED); /* fs attributes */ - out_uint32_le(out, stat_fs.f_namelen); /* max length of filename */ + out_uint32_le(out, F_NAMELEN(stat_fs)); /* max length of filename */ out_uint32_le(out, 2 * strlen(fs_type)); /* length of fs_type */ rdp_out_unistr(out, fs_type, 2 * strlen(fs_type) - 2); break;