Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc
Commits
02cae569
Commit
02cae569
authored
Jul 24, 2010
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
SaveConfigFile: correctly an error on I/O failure
parent
be235a08
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
1 deletion
+10
-1
src/config/file.c
src/config/file.c
+10
-1
No files found.
src/config/file.c
View file @
02cae569
...
@@ -437,7 +437,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
...
@@ -437,7 +437,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
if
(
config_PrepareDir
(
p_this
)
)
if
(
config_PrepareDir
(
p_this
)
)
{
{
msg_Err
(
p_this
,
"no configuration directory"
);
msg_Err
(
p_this
,
"no configuration directory"
);
goto
error
;
return
-
1
;
}
}
file
=
config_OpenConfigFile
(
p_this
);
file
=
config_OpenConfigFile
(
p_this
);
...
@@ -557,6 +557,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
...
@@ -557,6 +557,7 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
file
=
fdopen
(
fd
,
"wt"
);
file
=
fdopen
(
fd
,
"wt"
);
if
(
file
==
NULL
)
if
(
file
==
NULL
)
{
{
msg_Err
(
p_this
,
"cannot create configuration file: %m"
);
vlc_rwlock_unlock
(
&
config_lock
);
vlc_rwlock_unlock
(
&
config_lock
);
close
(
fd
);
close
(
fd
);
vlc_mutex_unlock
(
&
lock
);
vlc_mutex_unlock
(
&
lock
);
...
@@ -704,6 +705,14 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
...
@@ -704,6 +705,14 @@ static int SaveConfigFile( vlc_object_t *p_this, const char *psz_module_name,
* Flush to disk and replace atomically
* Flush to disk and replace atomically
*/
*/
fflush
(
file
);
/* Flush from run-time */
fflush
(
file
);
/* Flush from run-time */
if
(
ferror
(
file
))
{
vlc_unlink
(
temporary
);
vlc_mutex_unlock
(
&
lock
);
msg_Err
(
p_this
,
"cannot write configuration file"
);
clearerr
(
file
);
goto
error
;
}
#ifndef WIN32
#ifndef WIN32
#ifdef __APPLE__
#ifdef __APPLE__
fsync
(
fd
);
/* Flush from OS */
fsync
(
fd
);
/* Flush from OS */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment