Commit 54de9c06 authored by Simon McVittie's avatar Simon McVittie

DBusNonceFile: don't always fail when use_subdir=TRUE, i.e. on Unix

In shell-like pseudocode, the desired result is:

if $use_subdir
  dir = $tmpdir/dbus_nonce-$random
  path = $dir/nonce
  mkdir $dir
  write file at $path
else
  dir = $user_owned_place
  path = $dir/dbus_nonce-$random
  write file at $path

However, /nonce was accidentally appended to $dir instead of $path,
resulting in an attempt to mkdir /tmp/dbus_nonce-XXXX/nonce when
dbus_nonce-XXXX hadn't been created yet.

Bug: https://bugs.freedesktop.org/show_bug.cgi?id=34569Tested-by: default avatarDavid Zeuthen <davidz@redhat.com>
Reviewed-by: default avatarDavid Zeuthen <davidz@redhat.com>
parent 4bcffe1e
...@@ -275,7 +275,7 @@ do_noncefile_create (DBusNonceFile *noncefile, ...@@ -275,7 +275,7 @@ do_noncefile_create (DBusNonceFile *noncefile,
} }
if (!_dbus_string_init (&noncefile->path) if (!_dbus_string_init (&noncefile->path)
|| !_dbus_string_copy (&noncefile->dir, 0, &noncefile->path, 0) || !_dbus_string_copy (&noncefile->dir, 0, &noncefile->path, 0)
|| !_dbus_string_append (&noncefile->dir, "/nonce")) || !_dbus_string_append (&noncefile->path, "/nonce"))
{ {
dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL); dbus_set_error (error, DBUS_ERROR_NO_MEMORY, NULL);
goto on_error; goto on_error;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment