/mandos/trunk

To get this branch, use:
bzr branch http://bzr.recompile.se/loggerhead/mandos/trunk

« back to all changes in this revision

Viewing changes to mandos

  • Committer: Teddy Hogeborn
  • Date: 2024-11-24 14:41:36 UTC
  • mfrom: (1315 trunk)
  • mto: This revision was merged to the branch mainline in revision 1316.
  • Revision ID: teddy@recompile.se-20241124144136-0fej6fm6woitsooj
MergeĀ fromĀ trunk

Show diffs side-by-side

added added

removed removed

Lines of Context:
110
110
except AttributeError:
111
111
    shlex.quote = re.escape
112
112
 
 
113
# Add os.set_inheritable if it does not exist
 
114
try:
 
115
    os.set_inheritable
 
116
except AttributeError:
 
117
    def set_inheritable(fd, inheritable):
 
118
        flags = fcntl.fcntl(fd, fcntl.F_GETFD)
 
119
        if inheritable and ((flags & fcntl.FD_CLOEXEC) != 0):
 
120
            fcntl.fcntl(fd, fcntl.F_SETFL, flags & ~fcntl.FD_CLOEXEC)
 
121
        elif (not inheritable) and ((flags & fcntl.FD_CLOEXEC) == 0):
 
122
            fcntl.fcntl(fd, fcntl.F_SETFL, flags | fcntl.FD_CLOEXEC)
 
123
    os.set_inheritable = set_inheritable
 
124
    del set_inheritable
 
125
 
113
126
# Show warnings by default
114
127
if not sys.warnoptions:
115
128
    import warnings
3096
3109
        # Later, stdin will, and stdout and stderr might, be dup'ed
3097
3110
        # over with an opened os.devnull.  But we don't want this to
3098
3111
        # happen with a supplied network socket.
3099
 
        if 0 <= server_settings["socket"] <= 2:
 
3112
        while 0 <= server_settings["socket"] <= 2:
3100
3113
            server_settings["socket"] = os.dup(server_settings
3101
3114
                                               ["socket"])
 
3115
        os.set_inheritable(server_settings["socket"], False)
3102
3116
    del server_config
3103
3117
 
3104
3118
    # Override the settings from the config file with command line
3243
3257
    # From the Avahi example code
3244
3258
    DBusGMainLoop(set_as_default=True)
3245
3259
    main_loop = GLib.MainLoop()
3246
 
    bus = dbus.SystemBus()
 
3260
    if use_dbus or zeroconf:
 
3261
        bus = dbus.SystemBus()
3247
3262
    # End of Avahi example code
3248
3263
    if use_dbus:
3249
3264
        try: