aboutsummaryrefslogtreecommitdiff
path: root/src/util/service.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2018-12-11 17:47:58 +0100
committerChristian Grothoff <christian@grothoff.org>2018-12-11 17:47:58 +0100
commitcefc7647dc8db23452da80cfb4384cca641bb99d (patch)
tree80a7cecd85bacc33eb2baeb7da2c0a88e6b8d105 /src/util/service.c
parente68c4624f12fe7172ea6de5b4a5d89d9e49eae91 (diff)
downloadgnunet-cefc7647dc8db23452da80cfb4384cca641bb99d.tar.gz
gnunet-cefc7647dc8db23452da80cfb4384cca641bb99d.zip
make sure peer launches if default config not found and -c not given
Diffstat (limited to 'src/util/service.c')
-rw-r--r--src/util/service.c51
1 files changed, 30 insertions, 21 deletions
diff --git a/src/util/service.c b/src/util/service.c
index 2dc7dd576..098030ddf 100644
--- a/src/util/service.c
+++ b/src/util/service.c
@@ -1587,6 +1587,7 @@ return_agpl (void *cls,
1587 struct GNUNET_MessageHeader *res; 1587 struct GNUNET_MessageHeader *res;
1588 size_t slen; 1588 size_t slen;
1589 1589
1590 (void) msg;
1590 slen = strlen (GNUNET_AGPL_URL) + 1; 1591 slen = strlen (GNUNET_AGPL_URL) + 1;
1591 env = GNUNET_MQ_msg_extra (res, 1592 env = GNUNET_MQ_msg_extra (res,
1592 GNUNET_MESSAGE_TYPE_RESPONSE_AGPL, 1593 GNUNET_MESSAGE_TYPE_RESPONSE_AGPL,
@@ -1811,37 +1812,45 @@ GNUNET_SERVICE_run_ (int argc,
1811 GNUNET_break (0); 1812 GNUNET_break (0);
1812 goto shutdown; 1813 goto shutdown;
1813 } 1814 }
1814 if (NULL == opt_cfg_filename) 1815 if (NULL != opt_cfg_filename)
1815 opt_cfg_filename = GNUNET_strdup (cfg_filename);
1816 if (GNUNET_YES == GNUNET_DISK_file_test (opt_cfg_filename))
1817 { 1816 {
1818 if (GNUNET_SYSERR == 1817 if ( (GNUNET_YES !=
1819 GNUNET_CONFIGURATION_load (cfg, 1818 GNUNET_DISK_file_test (opt_cfg_filename)) ||
1820 opt_cfg_filename)) 1819 (GNUNET_SYSERR ==
1820 GNUNET_CONFIGURATION_load (cfg,
1821 opt_cfg_filename)) )
1821 { 1822 {
1822 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1823 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1823 _("Malformed configuration file `%s', exit ...\n"), 1824 _("Malformed configuration file `%s', exit ...\n"),
1824 opt_cfg_filename); 1825 opt_cfg_filename);
1825 goto shutdown; 1826 goto shutdown;
1826 } 1827 }
1827 } 1828 }
1828 else 1829 else
1829 { 1830 {
1830 if (GNUNET_SYSERR == 1831 if (GNUNET_YES ==
1831 GNUNET_CONFIGURATION_load (cfg, 1832 GNUNET_DISK_file_test (cfg_filename))
1832 NULL))
1833 { 1833 {
1834 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1834 if (GNUNET_SYSERR ==
1835 _("Malformed configuration, exit ...\n")); 1835 GNUNET_CONFIGURATION_load (cfg,
1836 goto shutdown; 1836 cfg_filename))
1837 {
1838 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1839 _("Malformed configuration file `%s', exit ...\n"),
1840 cfg_filename);
1841 goto shutdown;
1842 }
1837 } 1843 }
1838 if (0 != strcmp (opt_cfg_filename, 1844 else
1839 cfg_filename))
1840 { 1845 {
1841 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, 1846 if (GNUNET_SYSERR ==
1842 _("Could not access configuration file `%s'\n"), 1847 GNUNET_CONFIGURATION_load (cfg,
1843 opt_cfg_filename); 1848 NULL))
1844 goto shutdown; 1849 {
1850 GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
1851 _("Malformed configuration, exit ...\n"));
1852 goto shutdown;
1853 }
1845 } 1854 }
1846 } 1855 }
1847 if (GNUNET_OK != setup_service (&sh)) 1856 if (GNUNET_OK != setup_service (&sh))
@@ -1857,7 +1866,7 @@ GNUNET_SERVICE_run_ (int argc,
1857 LOG (GNUNET_ERROR_TYPE_DEBUG, 1866 LOG (GNUNET_ERROR_TYPE_DEBUG,
1858 "Service `%s' runs with configuration from `%s'\n", 1867 "Service `%s' runs with configuration from `%s'\n",
1859 service_name, 1868 service_name,
1860 opt_cfg_filename); 1869 (NULL != opt_cfg_filename) ? opt_cfg_filename : cfg_filename);
1861 if ((GNUNET_OK == 1870 if ((GNUNET_OK ==
1862 GNUNET_CONFIGURATION_get_value_number (sh.cfg, 1871 GNUNET_CONFIGURATION_get_value_number (sh.cfg,
1863 "TESTING", 1872 "TESTING",