~ubuntu-branches/ubuntu/maverick/transmission/maverick-updates

« back to all changes in this revision

Viewing changes to libtransmission/platform.c

  • Committer: Bazaar Package Importer
  • Author(s): Chris Coulson, Krzysztof Klimonda, Chris Coulson
  • Date: 2009-09-09 09:06:11 UTC
  • mfrom: (1.1.27 upstream)
  • Revision ID: james.westby@ubuntu.com-20090909090611-09ai2hyo66h1dhv8
Tags: 1.74-0ubuntu1
[ Krzysztof Klimonda ]
* Merge from debian unstable, remaining changes:
  - debian/control:
    + Added replaces & provides clutch (now included as part of transmission).
    + add liblaunchpad-integration to Build-Depends
  - debian/rules:
    + Create a PO template during package build.
  - debian/patches/01_lpi.patch:
    + Integrate Transmission with Launchpad
  - debian/patches/20_add_X-Ubuntu-Gettext-Domain.diff:
    + Add X-Ubuntu-Gettext-Domain to .desktop file.
* debian/control:
  - add lsb-release to Build-Depends
* This includes the QT client in transmission-qt.

[ Chris Coulson ]
* Update to new upstream version 1.74 (LP: #418367):
  - Better data recovery in the case of an OS or Transmission crash
  - If a data file is moved, stop the torrent instead of redownloading 
    it (LP: #419304).
  - Fix bug that didn't list some peers in the resume file and in PEX
  - More helpful torrent error messages
  - DHT now honors the bind-address-ipv4 configuration option
  - Fix Debian build error with miniupnpc
  - Fix Cygwin build error with strtold
  - Update to a newer snapshot of miniupnpc
  - Fix crash that occurred when adding torrents on some desktops
  - Synchronize the statusbar's and torrent list's speeds
  - Fix the Properties dialog's "Origin" field for multiple torrents
* debian/rules, debian/control:
  - Don't run autoreconf at build time and don't build-dep on libtool.
* debian/control:
  - transmission-common replaces transmission-gtk (<< 1.74) rather than
    (<= 1.73-1).
* Refreshed patches:
  - 01_lpi.patch.
  - dont_build_libevent.patch.
  - qt_client_use_system_libevent.patch.
* Dropped patches not needed anymore:
  - updateminiupnpcstrings_double_escape_slash.patch
* Added 99_autoreconf.patch for autotools update.

Show diffs side-by-side

added added

removed removed

Lines of Context:
7
7
 * This exemption does not extend to derived works not owned by
8
8
 * the Transmission project.
9
9
 *
10
 
 * $Id: platform.c 8792 2009-07-09 18:18:14Z titer $
 
10
 * $Id: platform.c 8929 2009-08-14 12:53:08Z charles $
11
11
 */
12
12
 
13
13
#ifdef WIN32
522
522
    tr_inf( _( "Searching for web interface file \"%s\"" ), tmp );
523
523
    tr_free( tmp );
524
524
    return ret;
525
 
    
526
525
}
527
526
 
528
527
const char *
554
553
            CFRelease( appRef );
555
554
 
556
555
            s = tr_buildPath( appString, "Contents", "Resources", "web", NULL );
557
 
            
 
556
 
558
557
            if( !isClutchDir( s ) ) {
559
558
                tr_free( s );
560
 
                
 
559
 
561
560
                /* Fallback to the Application Support folder */
562
561
                s = tr_buildPath( tr_sessionGetConfigDir( session ), "web", NULL );
563
562
                if( !isClutchDir( s ) ) {
570
569
 
571
570
            /* SHGetFolderPath explicitly requires MAX_PATH length */
572
571
            char dir[MAX_PATH];
573
 
            
 
572
 
574
573
            /* Generally, Web interface should be stored in a Web subdir of
575
574
             * calling executable dir. */
576
575
 
577
 
            if( s == NULL ) { 
 
576
            if( s == NULL ) {
578
577
                /* First, we should check personal AppData/Transmission/Web */
579
578
                SHGetFolderPath( NULL, CSIDL_COMMON_APPDATA, NULL, 0, dir );
580
579
                s = tr_buildPath( dir, "Transmission", "Web", NULL );
664
663
****
665
664
***/
666
665
 
667
 
tr_lockfile_state_t
668
 
tr_lockfile( const char * filename )
669
 
{
670
 
    tr_lockfile_state_t ret;
671
 
 
672
 
#ifdef WIN32
673
 
 
674
 
    HANDLE              file = CreateFile(
675
 
        filename,
676
 
        GENERIC_READ | GENERIC_WRITE,
677
 
        FILE_SHARE_READ |
678
 
        FILE_SHARE_WRITE,
679
 
        NULL,
680
 
        OPEN_ALWAYS,
681
 
        FILE_ATTRIBUTE_NORMAL,
682
 
        NULL );
683
 
    if( file == INVALID_HANDLE_VALUE )
684
 
        ret = TR_LOCKFILE_EOPEN;
685
 
    else if( !LockFile( file, 0, 0, 1, 1 ) )
686
 
        ret = TR_LOCKFILE_ELOCK;
687
 
    else
688
 
        ret = TR_LOCKFILE_SUCCESS;
689
 
 
690
 
#else
691
 
 
692
 
    int fd = open( filename, O_RDWR | O_CREAT, 0666 );
693
 
    if( fd < 0 )
694
 
        ret = TR_LOCKFILE_EOPEN;
695
 
    else
696
 
    {
697
 
        struct flock lk;
698
 
        memset( &lk, 0,  sizeof( lk ) );
699
 
        lk.l_start = 0;
700
 
        lk.l_len = 0;
701
 
        lk.l_type = F_WRLCK;
702
 
        lk.l_whence = SEEK_SET;
703
 
        if( -1 == fcntl( fd, F_SETLK, &lk ) )
704
 
            ret = TR_LOCKFILE_ELOCK;
705
 
        else
706
 
            ret = TR_LOCKFILE_SUCCESS;
707
 
    }
708
 
 
709
 
#endif
710
 
 
711
 
    return ret;
712
 
}
713
 
 
714
666
#ifdef WIN32
715
667
 
716
668
/* The following mmap functions are by Joerg Walter, and were taken from