Ignore:
Timestamp:
Aug 11, 2016, 9:18:14 AM (9 years ago)
Author:
dmik
Message:

samba server: Implement max log size with truncating when rename fails #2.

This fixes a wrong r947 commit.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/lib/util/debug.c

    r946 r948  
    645645        int         maxlog;
    646646        struct stat st;
     647#ifdef __OS2__
     648        int         force_trunc = 0;
     649#endif
    647650
    648651        /*
     
    676679                                        return;
    677680                                }
     681#ifdef __OS2__
     682                                /* Renaming an open file is not possible on
     683                                 * OS/2 so we close it and then rename. Note
     684                                 * that if this log file is also in use by
     685                                 * another process, rename will still fail; in
     686                                 * this case we fall back to simply truncating
     687                                 * the current file to stop its growth. */
     688                                debug_close_fd(state.fd);
     689                                state.fd = -1;
     690                                if (rename(state.debugf, name) == -1) {
     691                                        /* Most likely, some other samba process
     692                                         * is using this log file. In either case
     693                                         * our only option is to truncate it. */
     694                                        force_trunc = 1;
     695                                }
     696                                if (reopen_logs_internal() && force_trunc) {
     697                                        ftruncate(state.fd, 0);
     698                                }
     699#else
    678700                                (void)rename(state.debugf, name);
    679701
     
    682704                                        (void)rename(name, state.debugf);
    683705                                }
     706#endif
    684707                                SAFE_FREE(name);
    685708                        }
Note: See TracChangeset for help on using the changeset viewer.