AC_USE_SYSTEM_EXTENSIONS
AC_SYS_LARGEFILE
AC_PROG_AWK
-AC_PROG_CC
+AC_PROG_CC_STDC
AM_PROG_CC_C_O
AC_HEADER_STDC
AC_C_CONST
AM_MAINTAINER_MODE([enable])
PKG_PROG_PKG_CONFIG
-LT_INIT
+LT_INIT([dlopen disable-static pic-only])
## increment if the interface has additions, changes, removals.
LT_CURRENT=3
buf = NULL;
- fd = open (RELEASE_FILE, O_RDONLY);
+ fd = open (RELEASE_FILE, O_RDONLY|O_CLOEXEC);
if (fd == -1)
goto out;
assert (image != NULL);
- fp = fopen (image->filename, "r");
+ fp = fopen (image->filename, "re");
if (fp == NULL)
return false;
loop = calloc (1, sizeof (ply_event_loop_t));
- loop->epoll_fd = epoll_create (PLY_EVENT_LOOP_NUM_EVENT_HANDLERS);
+ loop->epoll_fd = epoll_create1(EPOLL_CLOEXEC);
loop->wakeup_time = PLY_EVENT_LOOP_NO_TIMED_WAKEUP;
assert (loop->epoll_fd >= 0);
{
assert (key_file != NULL);
- key_file->fp = fopen (key_file->filename, "r");
+ key_file->fp = fopen (key_file->filename, "re");
if (key_file->fp == NULL)
{
#include "ply-list.h"
#ifndef PLY_LOGGER_OPEN_FLAGS
-#define PLY_LOGGER_OPEN_FLAGS (O_WRONLY | O_TRUNC | O_CREAT | O_NOFOLLOW)
+#define PLY_LOGGER_OPEN_FLAGS (O_WRONLY | O_TRUNC | O_CREAT | O_NOFOLLOW | O_CLOEXEC)
#endif
#ifndef PLY_LOGGER_MAX_INJECTION_SIZE
* Charlie Brej <cbrej@cs.man.ac.uk>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <assert.h>
#include <errno.h>
#include <math.h>
assert (sender_fd != NULL);
assert (receiver_fd != NULL);
- if (pipe (pipe_fds) < 0)
+ if (pipe2 (pipe_fds, O_CLOEXEC | O_NONBLOCK) < 0)
return false;
- if (fcntl (pipe_fds[0], F_SETFD, O_NONBLOCK | FD_CLOEXEC) < 0)
- {
- ply_save_errno ();
- close (pipe_fds[0]);
- close (pipe_fds[1]);
- ply_restore_errno ();
- return false;
- }
-
- if (fcntl (pipe_fds[1], F_SETFD, O_NONBLOCK | FD_CLOEXEC) < 0)
- {
- ply_save_errno ();
- close (pipe_fds[0]);
- close (pipe_fds[1]);
- ply_restore_errno ();
- return false;
- }
-
*sender_fd = pipe_fds[1];
*receiver_fd = pipe_fds[0];
int fd;
const int should_pass_credentials = true;
- fd = socket (PF_UNIX, SOCK_STREAM, 0);
+ fd = socket (PF_UNIX, SOCK_STREAM|SOCK_CLOEXEC|SOCK_NONBLOCK, 0);
if (fd < 0)
return -1;
- if (fcntl (fd, F_SETFD, O_NONBLOCK | FD_CLOEXEC) < 0)
- {
- ply_save_errno ();
- close (fd);
- ply_restore_errno ();
-
- return -1;
- }
-
if (setsockopt (fd, SOL_SOCKET, SO_PASSCRED,
&should_pass_credentials, sizeof (should_pass_credentials)) < 0)
{
asprintf (&path, "/proc/%ld/stat", (long) pid);
ppid = 0;
- fp = fopen (path, "r");
+ fp = fopen (path, "re");
if (fp == NULL)
{
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ply-hashtable.h"
#include <stdlib.h>
#include <string.h>
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ply-hashtable.h"
#include "ply-list.h"
#include "ply-logger.h"
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#include "config.h"
+
#include "ply-image.h"
#include "ply-label.h"
#include "ply-pixel-buffer.h"
#include <stdlib.h>
#include <string.h>
-#include "config.h"
-
#include "script-lib-image.script.h"
static void image_free (script_obj_t *obj)
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#include "config.h"
+
#include "script.h"
#include "script-parse.h"
#include "script-execute.h"
#include <string.h>
#include <math.h>
-#include "config.h"
#include "script-lib-math.script.h"
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#include "config.h"
+
#include "ply-boot-splash-plugin.h"
#include "ply-utils.h"
#include "script.h"
#include <stdlib.h>
#include <string.h>
-#include "config.h"
-
#include "script-lib-plymouth.script.h"
static script_return_t plymouth_set_function (script_state_t *state,
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#include "config.h"
+
#include "script.h"
#include "script-parse.h"
#include "script-execute.h"
#include <stdlib.h>
#include <string.h>
-#include "config.h"
-
#include "script-lib-string.script.h"
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ply-hashtable.h"
#include "ply-list.h"
#include "ply-bitarray.h"
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ply-hashtable.h"
#include "ply-list.h"
#include "ply-bitarray.h"
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
script_scan_t *script_scan_file (const char *filename)
{
- int fd = open (filename, O_RDONLY);
+ int fd = open (filename, O_RDONLY|O_CLOEXEC);
if (fd < 0) return NULL;
script_scan_t *scan = script_scan_new ();
scan->name = strdup (filename);
*
* Written by: Charlie Brej <cbrej@cs.man.ac.uk>
*/
-#define _GNU_SOURCE
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include "ply-hashtable.h"
#include "ply-list.h"
#include "ply-bitarray.h"
assert (server != NULL);
- fd = accept (server->socket_fd, NULL, NULL);
+ fd = accept4 (server->socket_fd, NULL, NULL, SOCK_CLOEXEC);
if (fd < 0)
return;
* Foundation, Inc., 59 Temple Street #330, Boston, MA 02111-1307, USA.
*/
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>