~ubuntu-branches/ubuntu/maverick/dbus/maverick-security

« back to all changes in this revision

Viewing changes to dbus/dbus-sysdeps-util-unix.c

  • Committer: Bazaar Package Importer
  • Author(s): Jonathan Riddell
  • Date: 2010-09-27 13:06:32 UTC
  • mfrom: (1.1.23 upstream)
  • Revision ID: james.westby@ubuntu.com-20100927130632-bqs145trvchd2lmf
Tags: 1.4.0-0ubuntu1
* New upstream release
 - Fixes https://bugs.freedesktop.org/show_bug.cgi?id=17754 Race condition in protected_change_timeout
 - Requested by various upstream KDE developers http://lists.kde.org/?t=128514970000004&r=1&w=2

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22
22
 *
23
23
 */
 
24
 
 
25
#include <config.h>
24
26
#include "dbus-sysdeps.h"
25
27
#include "dbus-sysdeps-unix.h"
26
28
#include "dbus-internals.h"
 
29
#include "dbus-pipe.h"
27
30
#include "dbus-protocol.h"
28
31
#include "dbus-string.h"
29
32
#define DBUS_USERDB_INCLUDES_PRIVATE 1
248
251
      DBusString pid;
249
252
      int bytes;
250
253
 
251
 
      _dbus_verbose ("writing our pid to pipe %d\n", print_pid_pipe->fd_or_handle);
 
254
      _dbus_verbose ("writing our pid to pipe %"PRIuPTR"\n",
 
255
                     print_pid_pipe->fd_or_handle);
252
256
      
253
257
      if (!_dbus_string_init (&pid))
254
258
        {
419
423
    }
420
424
 
421
425
  vsyslog (flags, msg, args);
422
 
  
 
426
 
423
427
  if (severity == DBUS_SYSTEM_LOG_FATAL)
424
428
    exit (1);
425
429
}
443
447
  sigaction (sig,  &act, NULL);
444
448
}
445
449
 
446
 
 
447
 
/**
448
 
 * Removes a directory; Directory must be empty
449
 
 * 
450
 
 * @param filename directory filename
451
 
 * @param error initialized error object
452
 
 * @returns #TRUE on success
453
 
 */
454
 
dbus_bool_t
455
 
_dbus_delete_directory (const DBusString *filename,
456
 
                        DBusError        *error)
457
 
{
458
 
  const char *filename_c;
459
 
  
460
 
  _DBUS_ASSERT_ERROR_IS_CLEAR (error);
461
 
 
462
 
  filename_c = _dbus_string_get_const_data (filename);
463
 
 
464
 
  if (rmdir (filename_c) != 0)
465
 
    {
466
 
      dbus_set_error (error, DBUS_ERROR_FAILED,
467
 
                      "Failed to remove directory %s: %s\n",
468
 
                      filename_c, _dbus_strerror (errno));
469
 
      return FALSE;
470
 
    }
471
 
  
472
 
  return TRUE;
473
 
}
474
 
 
475
450
/** Checks if a file exists
476
451
*
477
452
* @param file full path to the file
1076
1051
static void
1077
1052
string_squash_nonprintable (DBusString *str)
1078
1053
{
1079
 
  char *buf;
 
1054
  unsigned char *buf;
1080
1055
  int i, len; 
1081
1056
  
1082
1057
  buf = _dbus_string_get_data (str);
1172
1147
  _dbus_string_free (&path);
1173
1148
  return FALSE;
1174
1149
}
1175