~ubuntu-branches/ubuntu/maverick/postfix/maverick-security

« back to all changes in this revision

Viewing changes to src/global/mail_open_ok.c

  • Committer: Bazaar Package Importer
  • Author(s): LaMont Jones, Wietse Venema, LaMont Jones
  • Date: 2009-06-03 14:17:08 UTC
  • mfrom: (1.1.22 upstream)
  • Revision ID: james.westby@ubuntu.com-20090603141708-o9u59xlor7nmd2x1
[Wietse Venema]

* New upstream release: 2.6.2~rc1

[LaMont Jones]

* move postfix-add-{filter,policy} manpages to section 8, and deliver
* provide: default-mta on ubuntu

Show diffs side-by-side

added added

removed removed

Lines of Context:
59
59
 
60
60
#include <sys_defs.h>
61
61
#include <sys/stat.h>
 
62
#include <time.h>
62
63
#include <errno.h>
63
64
 
64
65
/* Utility library. */
102
103
    }
103
104
    if ((statp->st_mode & S_IRWXU) != MAIL_QUEUE_STAT_READY)
104
105
        return (MAIL_OPEN_NO);
 
106
 
 
107
    /*
 
108
     * Workaround for spurious "file has 2 links" warnings in showq. As
 
109
     * kernels have evolved from non-interruptible system calls towards
 
110
     * fine-grained locks, the showq command has become likely to observe a
 
111
     * file while the queue manager is in the middle of renaming it, at a
 
112
     * time when the file has links to both the old and new name. We now log
 
113
     * the warning only when the condition appears to be persistent.
 
114
     */
 
115
#define MINUTE_SECONDS  60                      /* XXX should be centralized */
 
116
 
105
117
    if (statp->st_nlink > 1) {
106
 
        msg_warn("%s: uid %ld: file has %d links", *path,
107
 
                 (long) statp->st_uid, (int) statp->st_nlink);
 
118
        if (msg_verbose)
 
119
            msg_info("%s: uid %ld: file has %d links", *path,
 
120
                     (long) statp->st_uid, (int) statp->st_nlink);
 
121
        else if (statp->st_ctime < time((time_t *) 0) - MINUTE_SECONDS)
 
122
            msg_warn("%s: uid %ld: file has %d links", *path,
 
123
                     (long) statp->st_uid, (int) statp->st_nlink);
108
124
    }
109
125
    return (MAIL_OPEN_YES);
110
126
}