forked from pool/putty
Jan Engelhardt
584e925e18
[boo#1133181] OBS-URL: https://build.opensuse.org/package/show/X11:Utilities/putty?expand=0&rev=60
79 lines
3.2 KiB
Diff
79 lines
3.2 KiB
Diff
From 39c20d4819794417e4e84429d1eb5430e3865b25 Mon Sep 17 00:00:00 2001
|
|
From: Simon Tatham <anakin@pobox.com>
|
|
Date: Sat, 13 Apr 2019 18:52:28 +0100
|
|
Subject: [PATCH] Revert "settings.c: allow load_open_settings(NULL)."
|
|
|
|
This reverts commit 1b2f39c24bb6591a4192377d9393f5c3e45cb5bd.
|
|
|
|
The intention of that commit was to support the development of Uppity,
|
|
by arranging that I could get a Conf populated with completely default
|
|
values by calling load_open_settings(NULL,conf), with no risk of
|
|
interference from the normal PuTTY saved sessions full of client-side
|
|
configuration (which would have been confusing to apply unexpectedly
|
|
in a server).
|
|
|
|
So I arranged that a NULL session handle was never passed to the
|
|
low-level read_setting_[type] functions, in case it caused a segfault.
|
|
But I overlooked two things.
|
|
|
|
Firstly, on Unix, read_setting_* is where we check the tree234 of data
|
|
derived from X resources and/or -xrm command-line options. So if you
|
|
don't call those functions at all (e.g. if you have no on-disk PuTTY
|
|
saved configuration at all, not even Default Settings), you also don't
|
|
get your X defaults honoured.
|
|
|
|
Secondly, those functions themselves already all checked their
|
|
argument for NULL before doing anything dangerous with it. So the
|
|
thing I wanted to make possible was already possible _anyway_, without
|
|
me having to do anything!
|
|
|
|
So I'm exactly reverting that commit, because the _only_ thing it did
|
|
was to introduce a bug in X resource handling.
|
|
---
|
|
settings.c | 8 ++++----
|
|
1 file changed, 4 insertions(+), 4 deletions(-)
|
|
|
|
diff --git a/settings.c b/settings.c
|
|
index 54424f49..2c767a7a 100644
|
|
--- a/settings.c
|
|
+++ b/settings.c
|
|
@@ -107,7 +107,7 @@ char *get_remote_username(Conf *conf)
|
|
|
|
static char *gpps_raw(settings_r *sesskey, const char *name, const char *def)
|
|
{
|
|
- char *ret = sesskey ? read_setting_s(sesskey, name) : NULL;
|
|
+ char *ret = read_setting_s(sesskey, name);
|
|
if (!ret)
|
|
ret = platform_default_s(name);
|
|
if (!ret)
|
|
@@ -131,7 +131,7 @@ static void gpps(settings_r *sesskey, const char *name, const char *def,
|
|
static void gppfont(settings_r *sesskey, char *name,
|
|
Conf *conf, int primary)
|
|
{
|
|
- FontSpec *result = sesskey ? read_setting_fontspec(sesskey, name) : NULL;
|
|
+ FontSpec *result = read_setting_fontspec(sesskey, name);
|
|
if (!result)
|
|
result = platform_default_fontspec(name);
|
|
conf_set_fontspec(conf, primary, result);
|
|
@@ -140,7 +140,7 @@ static void gppfont(settings_r *sesskey, char *name,
|
|
static void gppfile(settings_r *sesskey, const char *name,
|
|
Conf *conf, int primary)
|
|
{
|
|
- Filename *result = sesskey ? read_setting_filename(sesskey, name) : NULL;
|
|
+ Filename *result = read_setting_filename(sesskey, name);
|
|
if (!result)
|
|
result = platform_default_filename(name);
|
|
conf_set_filename(conf, primary, result);
|
|
@@ -162,7 +162,7 @@ static void gppb(settings_r *sesskey, const char *name, bool def,
|
|
static int gppi_raw(settings_r *sesskey, const char *name, int def)
|
|
{
|
|
def = platform_default_i(name, def);
|
|
- return sesskey ? read_setting_i(sesskey, name, def) : def;
|
|
+ return read_setting_i(sesskey, name, def);
|
|
}
|
|
|
|
static void gppi(settings_r *sesskey, const char *name, int def,
|
|
--
|
|
2.21.0
|
|
|