Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
openrc-settingsd
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Nathaniel Russell
openrc-settingsd
Commits
25007269
Unverified
Commit
25007269
authored
1 year ago
by
Pablo Correa Gomez
Browse files
Options
Downloads
Patches
Plain Diff
timedated: use a more descriptive name for localtime2
parent
1ecd8c40
Branches
main
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/timedated.c
+10
-10
10 additions, 10 deletions
src/timedated.c
with
10 additions
and
10 deletions
src/timedated.c
+
10
−
10
View file @
25007269
...
...
@@ -109,28 +109,28 @@ static gboolean
set_localtime_file
(
const
gchar
*
identifier
,
GError
**
error
)
{
g_autofree
gchar
*
filebuf
=
NULL
,
*
localtime_filename
=
NULL
,
*
localtime2
_filename
=
NULL
;
g_autoptr
(
GFile
)
localtime2
_file
=
NULL
;
g_autofree
gchar
*
filebuf
=
NULL
,
*
localtime_filename
=
NULL
,
*
identifier
_filename
=
NULL
;
g_autoptr
(
GFile
)
identifier
_file
=
NULL
;
gsize
length
=
0
;
g_return_val_if_fail
(
error
!=
NULL
,
FALSE
);
localtime_filename
=
g_file_get_path
(
localtime_file
);
localtime2
_filename
=
g_strdup_printf
(
ZONEINFODIR
"/%s"
,
identifier
);
localtime2
_file
=
g_file_new_for_path
(
localtime2
_filename
);
identifier
_filename
=
g_strdup_printf
(
ZONEINFODIR
"/%s"
,
identifier
);
identifier
_file
=
g_file_new_for_path
(
identifier
_filename
);
if
(
g_file_test
(
localtime_filename
,
G_FILE_TEST_IS_SYMLINK
))
{
if
(
!
g_file_delete
(
localtime_file
,
NULL
,
error
))
{
g_prefix_error
(
error
,
"Unable to delete file to make new symlink %s:"
,
localtime_filename
);
return
FALSE
;
}
if
(
!
g_file_make_symbolic_link
(
localtime_file
,
localtime2
_filename
,
NULL
,
error
))
{
g_prefix_error
(
error
,
"Unable to create symlink %s -> %s:"
,
localtime_filename
,
localtime2
_filename
);
if
(
!
g_file_make_symbolic_link
(
localtime_file
,
identifier
_filename
,
NULL
,
error
))
{
g_prefix_error
(
error
,
"Unable to create symlink %s -> %s:"
,
localtime_filename
,
identifier
_filename
);
return
FALSE
;
}
}
else
if
(
g_file_test
(
localtime_filename
,
G_FILE_TEST_IS_REGULAR
))
{
if
(
!
g_file_load_contents
(
localtime2
_file
,
NULL
,
&
filebuf
,
&
length
,
NULL
,
error
))
{
g_prefix_error
(
error
,
"Unable to read '%s':"
,
localtime2
_filename
);
if
(
!
g_file_load_contents
(
identifier
_file
,
NULL
,
&
filebuf
,
&
length
,
NULL
,
error
))
{
g_prefix_error
(
error
,
"Unable to read '%s':"
,
identifier
_filename
);
return
FALSE
;
}
if
(
!
g_file_replace_contents
(
localtime_file
,
filebuf
,
length
,
NULL
,
FALSE
,
0
,
NULL
,
NULL
,
error
))
{
...
...
@@ -142,8 +142,8 @@ set_localtime_file (const gchar *identifier,
}
}
else
{
// File doesn't exist yet -> make a new symlink
if
(
!
g_file_make_symbolic_link
(
localtime_file
,
localtime2
_filename
,
NULL
,
error
))
{
g_prefix_error
(
error
,
"Unable to create symlink %s -> %s:"
,
localtime_filename
,
localtime2
_filename
);
if
(
!
g_file_make_symbolic_link
(
localtime_file
,
identifier
_filename
,
NULL
,
error
))
{
g_prefix_error
(
error
,
"Unable to create symlink %s -> %s:"
,
localtime_filename
,
identifier
_filename
);
return
FALSE
;
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment