aboutsummaryrefslogtreecommitdiff
path: root/tests/test-timezones.cpp
diff options
context:
space:
mode:
authorMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-04-01 14:15:39 +0200
committerMike Gabriel <mike.gabriel@das-netzwerkteam.de>2025-04-01 14:15:39 +0200
commit8493897dd48254f2bb40d5fdfe80d6031f891ce1 (patch)
tree794164306628f15d1d7a1ae0612215c366affaa8 /tests/test-timezones.cpp
parentf1f745daecd0912e17f30626309d412ad23cf47e (diff)
parentbe6251cb3234b292cbc3bb9b661d6a0777115f17 (diff)
downloadayatana-indicator-datetime-8493897dd48254f2bb40d5fdfe80d6031f891ce1.tar.gz
ayatana-indicator-datetime-8493897dd48254f2bb40d5fdfe80d6031f891ce1.tar.bz2
ayatana-indicator-datetime-8493897dd48254f2bb40d5fdfe80d6031f891ce1.zip
Merge branch 'tari01-pr/mkcal-backend'
Attributes GH PR #135: https://github.com/AyatanaIndicators/ayatana-indicator-datetime/pull/135
Diffstat (limited to 'tests/test-timezones.cpp')
-rw-r--r--tests/test-timezones.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/tests/test-timezones.cpp b/tests/test-timezones.cpp
index 7144aaf..1cbab16 100644
--- a/tests/test-timezones.cpp
+++ b/tests/test-timezones.cpp
@@ -1,5 +1,6 @@
/*
* Copyright 2013 Canonical Ltd.
+ * Copyright 2025 Robert Tari
*
* This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 3, as published
@@ -15,6 +16,7 @@
*
* Authors:
* Charles Kerr <charles.kerr@canonical.com>
+ * Robert Tari <robert@tari.in>
*/
#include "geoclue-fixture.h"
@@ -39,9 +41,13 @@ namespace
void set_file(const std::string& text)
{
auto fp = fopen(TIMEZONE_FILE, "w+");
- fprintf(fp, "%s\n", text.c_str());
- fclose(fp);
- sync();
+
+ if (fp)
+ {
+ fprintf(fp, "%s\n", text.c_str());
+ fclose(fp);
+ sync();
+ }
}
}