84 |
#define SOLARIS |
#define SOLARIS |
85 |
#endif |
#endif |
86 |
|
|
87 |
#ifdef SOLARIS |
#if (defined(SOLARIS) || defined(__hpux)) |
88 |
#define DIRFD(a) ((a)->dd_fd) |
#define DIRFD(a) ((a)->dd_fd) |
89 |
#else |
#else |
90 |
#define DIRFD(a) (dirfd(a)) |
#define DIRFD(a) (dirfd(a)) |
102 |
#include <time.h> /* ctime */ |
#include <time.h> /* ctime */ |
103 |
|
|
104 |
|
|
105 |
#if defined(SOLARIS) |
#if (defined(SOLARIS) || defined (__hpux) || defined(__BEOS__)) |
106 |
#include <sys/statvfs.h> /* solaris statvfs */ |
#include <sys/statvfs.h> /* solaris statvfs */ |
107 |
#define STATFS_FN(path, buf) (statvfs(path,buf)) |
#define STATFS_FN(path, buf) (statvfs(path,buf)) |
108 |
#define STATFS_T statvfs |
#define STATFS_T statvfs |
137 |
} |
} |
138 |
g_fileinfo[MAX_OPEN_FILES]; |
g_fileinfo[MAX_OPEN_FILES]; |
139 |
|
|
|
|
|
140 |
time_t |
time_t |
141 |
get_create_time(struct stat *st) |
get_create_time(struct stat *st) |
142 |
{ |
{ |
181 |
|
|
182 |
/* Enumeration of devices from rdesktop.c */ |
/* Enumeration of devices from rdesktop.c */ |
183 |
/* returns numer of units found and initialized. */ |
/* returns numer of units found and initialized. */ |
184 |
/* optarg looks like ':h:=/mnt/floppy,b:=/mnt/usbdevice1' */ |
/* optarg looks like ':h=/mnt/floppy,b=/mnt/usbdevice1' */ |
185 |
/* when it arrives to this function. */ |
/* when it arrives to this function. */ |
186 |
int |
int |
187 |
disk_enum_devices(int *id, char *optarg) |
disk_enum_devices(uint32 * id, char *optarg) |
188 |
{ |
{ |
189 |
char *pos = optarg; |
char *pos = optarg; |
190 |
char *pos2; |
char *pos2; |
340 |
case ENOENT: |
case ENOENT: |
341 |
|
|
342 |
return STATUS_NO_SUCH_FILE; |
return STATUS_NO_SUCH_FILE; |
343 |
|
case EEXIST: |
344 |
|
|
345 |
|
return STATUS_OBJECT_NAME_COLLISION; |
346 |
default: |
default: |
347 |
|
|
348 |
perror("open"); |
perror("open"); |
407 |
} |
} |
408 |
#endif |
#endif |
409 |
|
|
410 |
if (offset) |
lseek(handle, offset, SEEK_SET); |
411 |
lseek(handle, offset, SEEK_SET); |
|
412 |
n = read(handle, data, length); |
n = read(handle, data, length); |
413 |
|
|
414 |
if (n < 0) |
if (n < 0) |
434 |
{ |
{ |
435 |
int n; |
int n; |
436 |
|
|
437 |
if (offset) |
lseek(handle, offset, SEEK_SET); |
|
lseek(handle, offset, SEEK_SET); |
|
438 |
|
|
439 |
n = write(handle, data, length); |
n = write(handle, data, length); |
440 |
|
|
548 |
struct stat filestat; |
struct stat filestat; |
549 |
time_t write_time, change_time, access_time, mod_time; |
time_t write_time, change_time, access_time, mod_time; |
550 |
struct utimbuf tvs; |
struct utimbuf tvs; |
551 |
|
struct STATFS_T stat_fs; |
552 |
|
|
553 |
pfinfo = &(g_fileinfo[handle]); |
pfinfo = &(g_fileinfo[handle]); |
554 |
|
|
631 |
|
|
632 |
if (fchmod(handle, mode)) |
if (fchmod(handle, mode)) |
633 |
return STATUS_ACCESS_DENIED; |
return STATUS_ACCESS_DENIED; |
634 |
|
|
635 |
|
/* prevents start of writing if not enough space left on device */ |
636 |
|
if (STATFS_FN(g_rdpdr_device[pfinfo->device_id].local_path, &stat_fs) == 0) |
637 |
|
if (stat_fs.f_bsize * stat_fs.f_bfree < length) |
638 |
|
return STATUS_DISK_FULL; |
639 |
|
|
640 |
break; |
break; |
641 |
|
|
642 |
case 10: /* FileRenameInformation */ |
case 10: /* FileRenameInformation */ |
668 |
case 13: /* FileDispositionInformation */ |
case 13: /* FileDispositionInformation */ |
669 |
|
|
670 |
//unimpl("IRP Set File Information class: FileDispositionInformation\n"); |
//unimpl("IRP Set File Information class: FileDispositionInformation\n"); |
671 |
// in_uint32_le(in, delete_on_close); |
|
672 |
|
//in_uint32_le(in, delete_on_close); |
673 |
// disk_close(handle); |
// disk_close(handle); |
674 |
unlink(pfinfo->path); |
if ((pfinfo->flags_and_attributes & FILE_DIRECTORY_FILE)) // remove a directory |
675 |
|
{ |
676 |
|
if (rmdir(pfinfo->path) < 0) |
677 |
|
return STATUS_ACCESS_DENIED; |
678 |
|
} |
679 |
|
else if (unlink(pfinfo->path) < 0) // unlink a file |
680 |
|
return STATUS_ACCESS_DENIED; |
681 |
|
|
682 |
break; |
break; |
683 |
|
|
684 |
case 19: /* FileAllocationInformation */ |
case 19: /* FileAllocationInformation */ |