|
a/src/upmpd.cxx |
|
b/src/upmpd.cxx |
|
... |
|
... |
344 |
Usage();
|
344 |
Usage();
|
345 |
|
345 |
|
346 |
UpMpd::Options opts;
|
346 |
UpMpd::Options opts;
|
347 |
|
347 |
|
348 |
string iconpath;
|
348 |
string iconpath;
|
|
|
349 |
string cachedir;
|
349 |
if (!g_configfilename.empty()) {
|
350 |
if (!g_configfilename.empty()) {
|
350 |
ConfSimple config(g_configfilename.c_str(), 1, true);
|
351 |
ConfSimple config(g_configfilename.c_str(), 1, true);
|
351 |
if (!config.ok()) {
|
352 |
if (!config.ok()) {
|
352 |
cerr << "Could not open config: " << g_configfilename << endl;
|
353 |
cerr << "Could not open config: " << g_configfilename << endl;
|
353 |
return 1;
|
354 |
return 1;
|
|
... |
|
... |
373 |
}
|
374 |
}
|
374 |
if (config.get("ohmetapersist", value)) {
|
375 |
if (config.get("ohmetapersist", value)) {
|
375 |
ohmetapersist = atoi(value.c_str()) != 0;
|
376 |
ohmetapersist = atoi(value.c_str()) != 0;
|
376 |
}
|
377 |
}
|
377 |
config.get("iconpath", iconpath);
|
378 |
config.get("iconpath", iconpath);
|
|
|
379 |
config.get("cachedir", cachedir);
|
378 |
if (!(op_flags & OPT_i)) {
|
380 |
if (!(op_flags & OPT_i)) {
|
379 |
config.get("upnpiface", iface);
|
381 |
config.get("upnpiface", iface);
|
380 |
if (iface.empty()) {
|
382 |
if (iface.empty()) {
|
381 |
config.get("upnpip", upnpip);
|
383 |
config.get("upnpip", upnpip);
|
382 |
}
|
384 |
}
|
|
... |
|
... |
408 |
}
|
410 |
}
|
409 |
}
|
411 |
}
|
410 |
|
412 |
|
411 |
Pidfile pidfile(pidfilename);
|
413 |
Pidfile pidfile(pidfilename);
|
412 |
|
414 |
|
413 |
string cachedir;
|
|
|
414 |
|
|
|
415 |
// If started by root, do the pidfile + change uid thing
|
415 |
// If started by root, do the pidfile + change uid thing
|
416 |
uid_t runas(0);
|
416 |
uid_t runas(0);
|
417 |
if (geteuid() == 0) {
|
417 |
if (geteuid() == 0) {
|
418 |
struct passwd *pass = getpwnam(upmpdcliuser.c_str());
|
418 |
struct passwd *pass = getpwnam(upmpdcliuser.c_str());
|
419 |
if (pass == 0) {
|
419 |
if (pass == 0) {
|
|
... |
|
... |
431 |
}
|
431 |
}
|
432 |
if (pidfile.write_pid() != 0) {
|
432 |
if (pidfile.write_pid() != 0) {
|
433 |
LOGFAT("Can't write pidfile: " << pidfile.getreason() << endl);
|
433 |
LOGFAT("Can't write pidfile: " << pidfile.getreason() << endl);
|
434 |
return 1;
|
434 |
return 1;
|
435 |
}
|
435 |
}
|
|
|
436 |
if (cachedir.empty())
|
436 |
cachedir = "/var/cache/upmpdcli";
|
437 |
cachedir = "/var/cache/upmpdcli";
|
437 |
} else {
|
438 |
} else {
|
|
|
439 |
if (cachedir.empty())
|
438 |
cachedir = path_cat(path_tildexpand("~") , "/.cache/upmpdcli");
|
440 |
cachedir = path_cat(path_tildexpand("~") , "/.cache/upmpdcli");
|
439 |
}
|
441 |
}
|
440 |
|
442 |
|
441 |
string& mcfn = opts.cachefn;
|
443 |
string& mcfn = opts.cachefn;
|
442 |
if (ohmetapersist) {
|
444 |
if (ohmetapersist) {
|
443 |
opts.cachefn = path_cat(cachedir, "/metacache");
|
445 |
opts.cachefn = path_cat(cachedir, "/metacache");
|