Mercurial > gftp.yaz
comparison lib/local.c @ 255:2ad324cf4930
2003-8-11 Brian Masney <masneyb@gftp.org>
* lib/local.c (local_get_next_file) - fix for directories that are
symlinks
* src/gtk/*.[ch] - updated copyright dates to 2003 on all of the files
author | masneyb |
---|---|
date | Tue, 12 Aug 2003 01:05:02 +0000 |
parents | a46c2eef5139 |
children | 4610d25d4abb |
comparison
equal
deleted
inserted
replaced
254:b0c531678919 | 255:2ad324cf4930 |
---|---|
290 | 290 |
291 static int | 291 static int |
292 local_get_next_file (gftp_request * request, gftp_file * fle, int fd) | 292 local_get_next_file (gftp_request * request, gftp_file * fle, int fd) |
293 { | 293 { |
294 local_protocol_data * lpd; | 294 local_protocol_data * lpd; |
295 struct stat st, fst; | |
295 struct dirent *dirp; | 296 struct dirent *dirp; |
296 char *user, *group; | 297 char *user, *group; |
297 struct passwd *pw; | 298 struct passwd *pw; |
298 struct group *gr; | 299 struct group *gr; |
299 struct stat st; | |
300 | 300 |
301 /* the struct passwd and struct group are not thread safe. But, | 301 /* the struct passwd and struct group are not thread safe. But, |
302 we're ok here because I have threading turned off for the local | 302 we're ok here because I have threading turned off for the local |
303 protocol (see use_threads in local_init above) */ | 303 protocol (see use_threads in local_init above) */ |
304 g_return_val_if_fail (request != NULL, GFTP_EFATAL); | 304 g_return_val_if_fail (request != NULL, GFTP_EFATAL); |
318 return (GFTP_ERETRYABLE); | 318 return (GFTP_ERETRYABLE); |
319 } | 319 } |
320 | 320 |
321 fle->file = g_strdup (dirp->d_name); | 321 fle->file = g_strdup (dirp->d_name); |
322 if (lstat (fle->file, &st) != 0) | 322 if (lstat (fle->file, &st) != 0) |
323 { | |
324 closedir (lpd->dir); | |
325 lpd->dir = NULL; | |
326 return (GFTP_ERETRYABLE); | |
327 } | |
328 | |
329 if (stat (fle->file, &fst) != 0) | |
323 { | 330 { |
324 closedir (lpd->dir); | 331 closedir (lpd->dir); |
325 lpd->dir = NULL; | 332 lpd->dir = NULL; |
326 return (GFTP_ERETRYABLE); | 333 return (GFTP_ERETRYABLE); |
327 } | 334 } |
361 fle->attribs[0] == 'c')) | 368 fle->attribs[0] == 'c')) |
362 fle->size = (off_t) st.st_rdev; | 369 fle->size = (off_t) st.st_rdev; |
363 else | 370 else |
364 fle->size = st.st_size; | 371 fle->size = st.st_size; |
365 | 372 |
366 fle->isdir = S_ISDIR (st.st_mode); | 373 fle->isdir = S_ISDIR (fst.st_mode); |
367 fle->islink = S_ISLNK (st.st_mode); | 374 fle->islink = S_ISLNK (st.st_mode); |
368 fle->isexe = (st.st_mode & S_IXUSR) || | 375 fle->isexe = (fst.st_mode & S_IXUSR) || |
369 (st.st_mode & S_IXGRP) || | 376 (fst.st_mode & S_IXGRP) || |
370 (st.st_mode & S_IXOTH); | 377 (fst.st_mode & S_IXOTH); |
371 | 378 |
372 return (1); | 379 return (1); |
373 } | 380 } |
374 | 381 |
375 | 382 |