/[rdesktop]/sourceforge.net/trunk/rdesktop/disk.c
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /sourceforge.net/trunk/rdesktop/disk.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 902 by stargo, Sun May 8 17:03:04 2005 UTC revision 1240 by stargo, Sun Jul 2 13:03:22 2006 UTC
# Line 121  struct dummy_statfs_t Line 121  struct dummy_statfs_t
121          int f_namemax;          int f_namemax;
122  };  };
123    
124  int  static int
125  dummy_statfs(struct dummy_statfs_t *buf)  dummy_statfs(struct dummy_statfs_t *buf)
126  {  {
127          buf->f_blocks = 262144;          buf->f_blocks = 262144;
# Line 144  BOOL g_notify_stamp = False; Line 144  BOOL g_notify_stamp = False;
144    
145  typedef struct  typedef struct
146  {  {
147          char name[256];          char name[PATH_MAX];
148          char label[256];          char label[PATH_MAX];
149          unsigned long serial;          unsigned long serial;
150          char type[256];          char type[PATH_MAX];
151  } FsInfoType;  } FsInfoType;
152    
153  static NTSTATUS NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p);  static NTSTATUS NotifyInfo(NTHANDLE handle, uint32 info_class, NOTIFY * p);
# Line 201  ftruncate_growable(int fd, off_t length) Line 201  ftruncate_growable(int fd, off_t length)
201  {  {
202          int ret;          int ret;
203          off_t pos;          off_t pos;
204          static const char zero;          static const char zero = 0;
205    
206          /* Try the simple method first */          /* Try the simple method first */
207          if ((ret = ftruncate(fd, length)) != -1)          if ((ret = ftruncate(fd, length)) != -1)
# Line 209  ftruncate_growable(int fd, off_t length) Line 209  ftruncate_growable(int fd, off_t length)
209                  return ret;                  return ret;
210          }          }
211    
212          /*          /*
213           * Some kind of error. Perhaps we were trying to grow. Retry           * Some kind of error. Perhaps we were trying to grow. Retry
214           * in a safe way.           * in a safe way.
215           */           */
# Line 325  disk_enum_devices(uint32 * id, char *opt Line 325  disk_enum_devices(uint32 * id, char *opt
325                          fprintf(stderr, "share name %s truncated to %s\n", optarg,                          fprintf(stderr, "share name %s truncated to %s\n", optarg,
326                                  g_rdpdr_device[*id].name);                                  g_rdpdr_device[*id].name);
327    
328                  g_rdpdr_device[*id].local_path = xmalloc(strlen(pos2) + 1);                  g_rdpdr_device[*id].local_path = (char *) xmalloc(strlen(pos2) + 1);
329                  strcpy(g_rdpdr_device[*id].local_path, pos2);                  strcpy(g_rdpdr_device[*id].local_path, pos2);
330                  g_rdpdr_device[*id].device_type = DEVICE_TYPE_DISK;                  g_rdpdr_device[*id].device_type = DEVICE_TYPE_DISK;
331                  count++;                  count++;
# Line 344  disk_create(uint32 device_id, uint32 acc Line 344  disk_create(uint32 device_id, uint32 acc
344          NTHANDLE handle;          NTHANDLE handle;
345          DIR *dirp;          DIR *dirp;
346          int flags, mode;          int flags, mode;
347          char path[256];          char path[PATH_MAX];
348          struct stat filestat;          struct stat filestat;
349    
350          handle = 0;          handle = 0;
# Line 491  disk_create(uint32 device_id, uint32 acc Line 491  disk_create(uint32 device_id, uint32 acc
491          g_fileinfo[handle].device_id = device_id;          g_fileinfo[handle].device_id = device_id;
492          g_fileinfo[handle].flags_and_attributes = flags_and_attributes;          g_fileinfo[handle].flags_and_attributes = flags_and_attributes;
493          g_fileinfo[handle].accessmask = accessmask;          g_fileinfo[handle].accessmask = accessmask;
494          strncpy(g_fileinfo[handle].path, path, 255);          strncpy(g_fileinfo[handle].path, path, PATH_MAX - 1);
495          g_fileinfo[handle].delete_on_close = False;          g_fileinfo[handle].delete_on_close = False;
496          g_notify_stamp = True;          g_notify_stamp = True;
497    
# Line 698  NTSTATUS Line 698  NTSTATUS
698  disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)  disk_set_information(NTHANDLE handle, uint32 info_class, STREAM in, STREAM out)
699  {  {
700          uint32 length, file_attributes, ft_high, ft_low, delete_on_close;          uint32 length, file_attributes, ft_high, ft_low, delete_on_close;
701          char newname[256], fullpath[256];          char newname[PATH_MAX], fullpath[PATH_MAX];
702          struct fileinfo *pfinfo;          struct fileinfo *pfinfo;
703          int mode;          int mode;
704          struct stat filestat;          struct stat filestat;
# Line 960  NotifyInfo(NTHANDLE handle, uint32 info_ Line 960  NotifyInfo(NTHANDLE handle, uint32 info_
960                  if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))                  if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
961                          continue;                          continue;
962                  p->num_entries++;                  p->num_entries++;
963                  fullname = xmalloc(strlen(pfinfo->path) + strlen(dp->d_name) + 2);                  fullname = (char *) xmalloc(strlen(pfinfo->path) + strlen(dp->d_name) + 2);
964                  sprintf(fullname, "%s/%s", pfinfo->path, dp->d_name);                  sprintf(fullname, "%s/%s", pfinfo->path, dp->d_name);
965    
966                  if (!stat(fullname, &buf))                  if (!stat(fullname, &buf))
# Line 997  FsVolumeInfo(char *fpath) Line 997  FsVolumeInfo(char *fpath)
997    
998          while ((e = getmntent(fdfs)))          while ((e = getmntent(fdfs)))
999          {          {
1000                  if (strncmp(fpath, e->mnt_dir, strlen(fpath)) == 0)                  if (str_startswith(e->mnt_dir, fpath))
1001                  {                  {
1002                          strcpy(info.type, e->mnt_type);                          strcpy(info.type, e->mnt_type);
1003                          strcpy(info.name, e->mnt_fsname);                          strcpy(info.name, e->mnt_fsname);
# Line 1016  FsVolumeInfo(char *fpath) Line 1016  FsVolumeInfo(char *fpath)
1016                                                  info.serial =                                                  info.serial =
1017                                                          (buf[42] << 24) + (buf[41] << 16) +                                                          (buf[42] << 24) + (buf[41] << 16) +
1018                                                          (buf[40] << 8) + buf[39];                                                          (buf[40] << 8) + buf[39];
1019                                                  strncpy(info.label, buf + 43, 10);                                                  strncpy(info.label, (char*)buf + 43, 10);
1020                                                  info.label[10] = '\0';                                                  info.label[10] = '\0';
1021                                          }                                          }
1022                                          else if (lseek(fd, 32767, SEEK_SET) >= 0)       /* ISO9660 */                                          else if (lseek(fd, 32767, SEEK_SET) >= 0)       /* ISO9660 */
1023                                          {                                          {
1024                                                  read(fd, buf, sizeof(buf));                                                  read(fd, buf, sizeof(buf));
1025                                                  strncpy(info.label, buf + 41, 32);                                                  strncpy(info.label, (char*)buf + 41, 32);
1026                                                  info.label[32] = '\0';                                                  info.label[32] = '\0';
1027                                                  /* info.Serial = (buf[128]<<24)+(buf[127]<<16)+(buf[126]<<8)+buf[125]; */                                                  /* info.Serial = (buf[128]<<24)+(buf[127]<<16)+(buf[126]<<8)+buf[125]; */
1028                                          }                                          }
# Line 1112  NTSTATUS Line 1112  NTSTATUS
1112  disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)  disk_query_directory(NTHANDLE handle, uint32 info_class, char *pattern, STREAM out)
1113  {  {
1114          uint32 file_attributes, ft_low, ft_high;          uint32 file_attributes, ft_low, ft_high;
1115          char *dirname, fullpath[256];          char *dirname, fullpath[PATH_MAX];
1116          DIR *pdir;          DIR *pdir;
1117          struct dirent *pdirent;          struct dirent *pdirent;
1118          struct stat fstat;          struct stat fstat;
# Line 1130  disk_query_directory(NTHANDLE handle, ui Line 1130  disk_query_directory(NTHANDLE handle, ui
1130                          /* If a search pattern is received, remember this pattern, and restart search */                          /* If a search pattern is received, remember this pattern, and restart search */
1131                          if (pattern[0] != 0)                          if (pattern[0] != 0)
1132                          {                          {
1133                                  strncpy(pfinfo->pattern, 1 + strrchr(pattern, '/'), 64);                                  strncpy(pfinfo->pattern, 1 + strrchr(pattern, '/'), PATH_MAX - 1);
1134                                  rewinddir(pdir);                                  rewinddir(pdir);
1135                          }                          }
1136    

Legend:
Removed from v.902  
changed lines
  Added in v.1240

  ViewVC Help
Powered by ViewVC 1.1.26