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) |
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 |
*/ |
*/ |
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++; |
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, PATH_MAX-1); |
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 |
|
|
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)) |
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); |
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, '/'), PATH_MAX-1); |
strncpy(pfinfo->pattern, 1 + strrchr(pattern, '/'), PATH_MAX - 1); |
1134 |
rewinddir(pdir); |
rewinddir(pdir); |
1135 |
} |
} |
1136 |
|
|