Changeset 279


Ignore:
Timestamp:
Jun 18, 2009, 6:03:07 PM (16 years ago)
Author:
Herwig Bauernfeind
Message:

Change in debug.c (by ydario)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/samba-3.0/source/lib/debug.c

    r165 r279  
    574574        else {
    575575                const char *p = strrchr_m( pname,'/' );
     576                if (!p)
     577                        p = strrchr_m( pname,'\\' );
    576578                if (p)
    577579                        pname = p + 1;
     
    606608
    607609        oldumask = umask( 022 );
    608  
     610
    609611        pstrcpy(fname, debugf );
    610612        debugf[0] = '\0';
     
    619621
    620622        pstrcpy( debugf, fname );
    621         new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0644);
     623
     624#ifdef __OS2__
     625        // YD we need to close the file before reopening, otherwise it is not
     626        // possible to rename the log
     627        if (dbf) {
     628                (void) x_fclose(dbf);
     629                dbf = NULL;
     630        }
     631#endif
     632
     633        new_dbf = x_fopen( debugf, O_WRONLY|O_APPEND|O_CREAT, 0777);
    622634
    623635        if (!new_dbf) {
     
    644656
    645657        /* Take over stderr to catch ouput into logs */
     658#ifndef __OS2__
     659        // this opens debug file twice!
    646660        if (dbf && sys_dup2(x_fileno(dbf), 2) == -1) {
    647661                close_low_fds(True); /* Close stderr too, if dup2 can't point it
    648662                                        at the logfile */
    649663        }
     664#endif
    650665
    651666        return ret;
     
    708723
    709724                        slprintf( name, sizeof(name)-1, "%s.old", debugf );
     725#ifdef __OS2__
     726                        (void)unlink( name );
     727#endif
    710728                        (void)rename( debugf, name );
    711      
     729
    712730                        if (!reopen_logs()) {
    713731                                /* We failed to reopen a log - continue using the old name. */
Note: See TracChangeset for help on using the changeset viewer.