SVN commit 1082803 by lunakl: Do not close the OOM protection pipe at startup. M +13 -4 kinit.cpp --- trunk/KDE/kdelibs/kinit/kinit.cpp #1082802:1082803 @@ -160,6 +160,10 @@ #include extern "C" KIO::AuthInfo* _kioslave_init_kio() { return new KIO::AuthInfo(); } +#ifdef KDEINIT_OOM_PROTECT +static int oom_pipe = -1; +#endif + /* * Clean up the file descriptor table by closing all file descriptors * that are still open. @@ -174,7 +178,10 @@ if (getrlimit(RLIMIT_NOFILE, &rl) == 0) maxfd = rl.rlim_max; for (int fd = 3; fd < maxfd; ++fd) - close(fd); + { + if( fd != oom_pipe ) + close(fd); + } } /* @@ -419,8 +426,6 @@ } #ifdef KDEINIT_OOM_PROTECT -static int oom_pipe = -1; - static void oom_protect_sighandler( int ) { } @@ -439,7 +444,11 @@ pid_t pid = getpid(); if( write( oom_pipe, &pid, sizeof( pid_t )) > 0 ) { sigsuspend( &oldsigs ); // wait for the signal to come - } + } else { +#ifndef NDEBUG + fprintf( stderr, "Failed to reset OOM protection: %d\n", pid ); +#endif + } sigprocmask( SIG_SETMASK, &oldsigs, NULL ); sigaction( SIGUSR1, &oldact, NULL ); close( oom_pipe );