X-Git-Url: https://git.octo.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Frrd_update.c;h=5536c3c7e6b57928a4c5348d1f6b9f63cacefd10;hb=c68ae5a3674d315df30bc7729b3d89fa7ab83923;hp=681dcc47ea6b0219909978c1474bc4467f50cbb6;hpb=6854d4505cb83d61f1070fced0b05e489b0a3b1e;p=rrdtool.git diff --git a/src/rrd_update.c b/src/rrd_update.c index 681dcc4..5536c3c 100644 --- a/src/rrd_update.c +++ b/src/rrd_update.c @@ -377,8 +377,6 @@ int rrd_update( { struct option long_options[] = { {"template", required_argument, 0, 't'}, - {"cache", optional_argument, 0, 'c'}, - {"nocache", no_argument , 0, 'n'}, {"daemon", required_argument, 0, 'd'}, {0, 0, 0, 0} }; @@ -392,7 +390,7 @@ int rrd_update( opterr = 0; /* initialize getopt */ while (1) { - opt = getopt_long(argc, argv, "t:cnd:", long_options, &option_index); + opt = getopt_long(argc, argv, "t:d:", long_options, &option_index); if (opt == EOF) break; @@ -432,6 +430,22 @@ int rrd_update( goto out; } + if ((tmplt == NULL) && (daemon == NULL)) + { + char *temp; + + temp = getenv (ENV_RRDCACHED_ADDRESS); + if (temp != NULL) + { + daemon = strdup (temp); + if (daemon == NULL) + { + rrd_set_error("strdup failed."); + goto out; + } + } + } + if (daemon != NULL) { int status; @@ -565,6 +579,15 @@ int _rrd_update( rra_step_cnt, updvals, tmpl_idx, tmpl_cnt, &pcdp_summary, version, skip_update, &schedule_smooth) == -1) { + if (rrd_test_error()) { /* Should have error string always here */ + char *save_error; + + /* Prepend file name to error message */ + if ((save_error = strdup(rrd_get_error())) != NULL) { + rrd_set_error("%s: %s", filename, save_error); + free(save_error); + } + } free(arg_copy); break; }