comparison src/uicommon/gftpui.c @ 774:2adc6b8b3197

2006-7-19 Brian Masney <masneyb@gftp.org> * src/uicommon/gftpui.c - make sure the directories have the proper permissions when "preserve file permissions" is enabled (from Aurelien Jarno <aurelien@aurel32.net>) (closes #312722)
author masneyb
date Thu, 20 Jul 2006 02:20:49 +0000
parents 1ad4eb5c29de
children c1144630c4f4
comparison
equal deleted inserted replaced
773:942dd9c2a064 774:2adc6b8b3197
1293 1293
1294 tdata->curfle = tdata->files; 1294 tdata->curfle = tdata->files;
1295 gettimeofday (&tdata->starttime, NULL); 1295 gettimeofday (&tdata->starttime, NULL);
1296 memcpy (&tdata->lasttime, &tdata->starttime, sizeof (tdata->lasttime)); 1296 memcpy (&tdata->lasttime, &tdata->starttime, sizeof (tdata->lasttime));
1297 1297
1298 gftp_lookup_request_option (tdata->fromreq, "preserve_permissions",
1299 &preserve_permissions);
1300 gftp_lookup_request_option (tdata->fromreq, "preserve_time",
1301 &preserve_time);
1302
1298 while (tdata->curfle != NULL) 1303 while (tdata->curfle != NULL)
1299 { 1304 {
1300 num_read = -1; 1305 num_read = -1;
1301 1306
1302 if (g_thread_supported ()) 1307 if (g_thread_supported ())
1331 if (tdata->toreq->mkdir != NULL) 1336 if (tdata->toreq->mkdir != NULL)
1332 { 1337 {
1333 tdata->toreq->mkdir (tdata->toreq, curfle->destfile); 1338 tdata->toreq->mkdir (tdata->toreq, curfle->destfile);
1334 if (!GFTP_IS_CONNECTED (tdata->toreq)) 1339 if (!GFTP_IS_CONNECTED (tdata->toreq))
1335 break; 1340 break;
1341
1342 if (preserve_permissions && curfle->st_mode != 0)
1343 gftp_chmod (tdata->toreq, curfle->destfile,
1344 curfle->st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));
1345
1346 if (preserve_time && curfle->datetime != 0)
1347 gftp_set_file_time (tdata->toreq, curfle->destfile,
1348 curfle->datetime);
1336 } 1349 }
1337 1350
1338 if (g_thread_supported ()) 1351 if (g_thread_supported ())
1339 g_static_mutex_lock (&tdata->structmutex); 1352 g_static_mutex_lock (&tdata->structmutex);
1340 1353
1474 _("There was an error transfering the file %s"), 1487 _("There was an error transfering the file %s"),
1475 curfle->file); 1488 curfle->file);
1476 } 1489 }
1477 } 1490 }
1478 1491
1479 gftp_lookup_request_option (tdata->fromreq, "preserve_permissions",
1480 &preserve_permissions);
1481 gftp_lookup_request_option (tdata->fromreq, "preserve_time",
1482 &preserve_time);
1483
1484 if (!curfle->is_fd) 1492 if (!curfle->is_fd)
1485 { 1493 {
1486 if (preserve_permissions && curfle->st_mode != 0) 1494 if (preserve_permissions && curfle->st_mode != 0)
1487 gftp_chmod (tdata->toreq, curfle->destfile, 1495 gftp_chmod (tdata->toreq, curfle->destfile,
1488 curfle->st_mode & (S_IRWXU | S_IRWXG | S_IRWXO)); 1496 curfle->st_mode & (S_IRWXU | S_IRWXG | S_IRWXO));