Split grml-scripts into grml-scripts and grml-scripts-core
[grml-scripts-core.git] / compile / dpkg_not_running.c
diff --git a/compile/dpkg_not_running.c b/compile/dpkg_not_running.c
deleted file mode 100644 (file)
index e6e1da7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/* Filename:      dpkg_not_running
-*  Purpose:       check whether Debian's package management (dpkg) is running
-*  Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
-*  Bug-Reports:   see http://grml.org/bugs/
-*  License:       This file is licensed under the GPL v2.
-*******************************************************************************/
-// return 0 if it is not running; return 1 if it is running
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <fcntl.h>
-#include <unistd.h>
-
-int main(int argc, char *argv[])
-{
-    struct flock fl = { F_WRLCK, SEEK_SET, 0, 0, 0 };
-    int fd;
-    fl.l_pid = getpid();
-
-    if ((fd = open("/var/lib/dpkg/lock", O_RDWR)) == -1) {
-        exit(1);
-    }
-
-    if (fcntl(fd, F_SETLK, &fl) == -1) {
-        exit(1); // it is running
-    }
-    else {
-        exit(0); // it is not running
-    }
-
-    return 0;
-}
-
-/* END OF FILE ****************************************************************/