Merge pull request #248 from Arnavion/utf8-everywhere
Fixed some remaining C file I/O API calls to use the glib API
This commit is contained in:
commit
aaa863535d
|
@ -849,11 +849,9 @@ save_config (void)
|
||||||
check_prefs_dir ();
|
check_prefs_dir ();
|
||||||
|
|
||||||
config = default_file ();
|
config = default_file ();
|
||||||
new_config = malloc (strlen (config) + 5);
|
new_config = g_strdup_printf (config, ".new");
|
||||||
strcpy (new_config, config);
|
|
||||||
strcat (new_config, ".new");
|
|
||||||
|
|
||||||
fh = open (new_config, OFLAGS | O_TRUNC | O_WRONLY | O_CREAT, 0600);
|
fh = g_open (new_config, OFLAGS | O_TRUNC | O_WRONLY | O_CREAT, 0600);
|
||||||
if (fh == -1)
|
if (fh == -1)
|
||||||
{
|
{
|
||||||
free (new_config);
|
free (new_config);
|
||||||
|
|
|
@ -1607,25 +1607,25 @@ file_exists (char *fname)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
copy_file (char *dl_src, char *dl_dest, int permissions) /* FS encoding */
|
copy_file (char *dl_src, char *dl_dest, int permissions)
|
||||||
{
|
{
|
||||||
int tmp_src, tmp_dest;
|
int tmp_src, tmp_dest;
|
||||||
gboolean ok = FALSE;
|
gboolean ok = FALSE;
|
||||||
char dl_tmp[4096];
|
char dl_tmp[4096];
|
||||||
int return_tmp, return_tmp2;
|
int return_tmp, return_tmp2;
|
||||||
|
|
||||||
if ((tmp_src = open (dl_src, O_RDONLY | OFLAGS)) == -1)
|
if ((tmp_src = g_open (dl_src, O_RDONLY | OFLAGS)) == -1)
|
||||||
{
|
{
|
||||||
fprintf (stderr, "Unable to open() file '%s' (%s) !", dl_src,
|
g_fprintf (stderr, "Unable to open() file '%s' (%s) !", dl_src,
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((tmp_dest =
|
if ((tmp_dest =
|
||||||
open (dl_dest, O_WRONLY | O_CREAT | O_TRUNC | OFLAGS, permissions)) < 0)
|
g_fprintf (dl_dest, O_WRONLY | O_CREAT | O_TRUNC | OFLAGS, permissions)) < 0)
|
||||||
{
|
{
|
||||||
close (tmp_src);
|
close (tmp_src);
|
||||||
fprintf (stderr, "Unable to create file '%s' (%s) !", dl_src,
|
g_fprintf (stderr, "Unable to create file '%s' (%s) !", dl_src,
|
||||||
strerror (errno));
|
strerror (errno));
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1258,7 +1258,7 @@ savebuffer_req_done (session *sess, char *file)
|
||||||
if (!file)
|
if (!file)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fh = open (file, O_TRUNC | O_WRONLY | O_CREAT, 0600);
|
fh = g_open (file, O_TRUNC | O_WRONLY | O_CREAT, 0600);
|
||||||
if (fh != -1)
|
if (fh != -1)
|
||||||
{
|
{
|
||||||
gtk_xtext_save (GTK_XTEXT (sess->gui->xtext), fh);
|
gtk_xtext_save (GTK_XTEXT (sess->gui->xtext), fh);
|
||||||
|
|
Loading…
Reference in New Issue