Пример #1
0
static gboolean
afunix_sd_setup_addresses(AFSocketSourceDriver *s)
{
  AFUnixSourceDriver *self = (AFUnixSourceDriver *) s;

  if (!afsocket_sd_setup_addresses_method(s))
    return FALSE;

  if (self->create_dirs)
    {
      if (!file_perm_options_create_containing_directory(&self->file_perm_options, self->filename))
        return FALSE;
    }

  if (!self->super.bind_addr)
    self->super.bind_addr = g_sockaddr_unix_new(self->filename);

  return TRUE;
}
Пример #2
0
static inline gboolean
_obtain_capabilities(gchar *name, FileOpenOptions *open_opts, FilePermOptions *perm_opts, cap_t *act_caps)
{
  if (open_opts->needs_privileges)
    {
      g_process_cap_modify(CAP_DAC_READ_SEARCH, TRUE);
      g_process_cap_modify(CAP_SYSLOG, TRUE);
    }
  else
    {
      g_process_cap_modify(CAP_DAC_OVERRIDE, TRUE);
    }

  if (open_opts->create_dirs && perm_opts &&
      !file_perm_options_create_containing_directory(perm_opts, name))
    {
      return FALSE;
    }

  return TRUE;
}