diff options
author | bviktor <bviktor@outlook.com> | 2012-11-03 21:48:56 -0700 |
---|---|---|
committer | bviktor <bviktor@outlook.com> | 2012-11-03 21:48:56 -0700 |
commit | 3c5284f19de644e010d0dfe85d179fb5633c92fb (patch) | |
tree | cfcfb0f27d78dd65bb657f0e0caeabb42737cc03 /src/common/servlist.c | |
parent | e0b1724158d44370d34d108a5f07fe0b36e4e254 (diff) | |
parent | c2c23894fc4e376ff10c9c3cbcfa5c350c1e3073 (diff) |
Merge pull request #224 from Arnavion/utf8-everywhere
UTF-8 everywhere
Diffstat (limited to 'src/common/servlist.c')
-rw-r--r-- | src/common/servlist.c | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/src/common/servlist.c b/src/common/servlist.c index f3697c2c..c42c371d 100644 --- a/src/common/servlist.c +++ b/src/common/servlist.c @@ -1159,7 +1159,7 @@ int servlist_save (void) { FILE *fp; - char buf[256]; + char *buf; ircnet *net; ircserver *serv; GSList *list; @@ -1167,20 +1167,27 @@ servlist_save (void) #ifndef WIN32 int first = FALSE; - snprintf (buf, sizeof (buf), "%s/servlist_.conf", get_xdir_fs ()); - if (access (buf, F_OK) != 0) + buf = g_strdup_printf ("%s/servlist_.conf", get_xdir ()); + if (g_access (buf, F_OK) != 0) first = TRUE; #endif fp = hexchat_fopen_file ("servlist_.conf", "w", 0); if (!fp) + { +#ifndef WIN32 + g_free (buf); +#endif return FALSE; + } #ifndef WIN32 if (first) - chmod (buf, 0600); + g_chmod (buf, 0600); + + g_free (buf); #endif - fprintf (fp, "v="PACKAGE_VERSION"\n\n"); + fprintf (fp, "v=" PACKAGE_VERSION "\n\n"); list = network_list; while (list) @@ -1210,9 +1217,10 @@ servlist_save (void) fprintf (fp, "E=%s\n", net->encoding); if (!servlist_check_encoding (net->encoding)) { - snprintf (buf, sizeof (buf), _("Warning: \"%s\" character set is unknown. No conversion will be applied for network %s."), + buf = g_strdup_printf (_("Warning: \"%s\" character set is unknown. No conversion will be applied for network %s."), net->encoding, net->name); fe_message (buf, FE_MSG_WARN); + g_free (buf); } } |