Subversion Repositories DevTools

Rev

Rev 5882 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 5882 Rev 5883
Line 382... Line 382...
382
    **  as the createPaths function will not create the last element
382
    **  as the createPaths function will not create the last element
383
    */
383
    */
384
    createPaths( dst );
384
    createPaths( dst );
385
 
385
 
386
    /*
386
    /*
387
    ** Sometimes symlinks are handled differently
387
    ** Sometimes symlinks are handled differently 
-
 
388
    **      If marked as a symlink
-
 
389
    **      And it is a symlink
388
    */
390
    */
389
    if (strstr( argv[5], "+l" ))
391
    if (strstr( argv[5], "+l" ))
390
    {
392
    {
391
        rv = lstat(src, &lfstat); 
393
        rv = lstat(src, &lfstat); 
392
        if ( rv == 0 && S_ISLNK(lfstat.st_mode))
394
        if ( rv == 0 && S_ISLNK(lfstat.st_mode))
Line 396... Line 398...
396
            symlink = 1;
398
            symlink = 1;
397
            if ( ! CopyLink( src, dst, lfstat.st_size ) )
399
            if ( ! CopyLink( src, dst, lfstat.st_size ) )
398
            {
400
            {
399
                ErrorExit("Copy Symlink Error: ", argv[4]);
401
                ErrorExit("Copy Symlink Error: ", argv[4]);
400
            }
402
            }
-
 
403
 
-
 
404
            /*
-
 
405
            **  Test for file (symlink) existence
-
 
406
            **  Doesn't need the target to be present
-
 
407
            */
-
 
408
            if ( verbose > 1 )
-
 
409
                fprintf(stderr, "Test symlink was created: %s\n", dst);
-
 
410
 
-
 
411
            rv = lstat( dst, &lfstat );
-
 
412
            if ( rv != 0 )
-
 
413
            {
-
 
414
        /* Need to be a better message */
-
 
415
                ErrorExit("Symlink not found after creation: ", argv[3]);
-
 
416
            }
401
        }
417
        }
402
    }
418
    }
403
 
419
 
404
    /*
-
 
405
    **   Copy the file
420
    if (!symlink)
406
    */
-
 
407
    if ( ! CopyFile( src, dst, fstat.st_mode ) )
-
 
408
    {
421
    {
-
 
422
        /*
-
 
423
        **   Copy the file
-
 
424
        */
-
 
425
        if ( ! CopyFile( src, dst, fstat.st_mode ) )
-
 
426
        {
409
        ErrorExit("Copy Error: ", argv[4]);
427
            ErrorExit("Copy Error: ", argv[4]);
410
    }
428
        }
411
 
429
 
412
    /*
430
        /*
413
    **  Test for files existence
431
        **  Test for files existence
414
    */
432
        */
415
    if ( verbose > 1 )
433
        if ( verbose > 1 )
416
        fprintf(stderr, "Test target was copied: %s\n", dst);
434
            fprintf(stderr, "Test target was copied: %s\n", dst);
417
 
435
 
418
    rv = stat( dst, &fstat );
436
        rv = stat( dst, &fstat );
419
    if ( rv != 0 )
437
        if ( rv != 0 )
420
    {
438
        {
421
/* Need to be a better message */
439
    /* Need to be a better message */
422
        ErrorExit("File not found after copy: ", argv[3]);
440
            ErrorExit("File not found after copy: ", argv[3]);
423
    }
441
        }
424
 
442
 
425
    /*
443
        /*
426
    **  Set the files attributes, unless copying a symlink
444
        **  Set the files attributes, unless copying a symlink
427
    **      Assume read-only
445
        **      Assume read-only
428
    */
446
        */
429
    if (!symlink)
-
 
430
    {
-
 
431
        if (strstr(argv[5], "-w")) 
447
        if (strstr(argv[5], "-w")) 
432
        {
448
        {
433
            if ( verbose > 1 )
449
            if ( verbose > 1 )
434
                fprintf(stderr, "Set target read-only: %s\n", dst);
450
                fprintf(stderr, "Set target read-only: %s\n", dst);
435
            fstat.st_mode &= ~(S_IWRITE | S_IWOTH | S_IWGRP );
451
            fstat.st_mode &= ~(S_IWRITE | S_IWOTH | S_IWGRP );