Switch to unified view

a/src/main.cxx b/src/main.cxx
...
...
189
        savedargs.push_back(argv[i]);
189
        savedargs.push_back(argv[i]);
190
    }
190
    }
191
    
191
    
192
    // Path for the sc2mpd command, or empty
192
    // Path for the sc2mpd command, or empty
193
    string sc2mpdpath;
193
    string sc2mpdpath;
194
    string screceiverstatefile;
194
195
195
    // Sender mode: path for the command creating the mpd and mpd2sc
196
    // Sender mode: path for the command creating the mpd and mpd2sc
196
    // processes, and port for the auxiliary mpd.
197
    // processes, and port for the auxiliary mpd.
197
    string senderpath;
198
    string senderpath;
198
    int sendermpdport = 6700;
199
    int sendermpdport = 6700;
...
...
350
        }
351
        }
351
        if (g_config->get("schttpport", value))
352
        if (g_config->get("schttpport", value))
352
            opts.schttpport = atoi(value.c_str());
353
            opts.schttpport = atoi(value.c_str());
353
        g_config->get("scplaymethod", opts.scplaymethod);
354
        g_config->get("scplaymethod", opts.scplaymethod);
354
        g_config->get("sc2mpd", sc2mpdpath);
355
        g_config->get("sc2mpd", sc2mpdpath);
356
        g_config->get("screceiverstatefile", screceiverstatefile);
355
        if (g_config->get("ohmetasleep", value))
357
        if (g_config->get("ohmetasleep", value))
356
            opts.ohmetasleep = atoi(value.c_str());
358
            opts.ohmetasleep = atoi(value.c_str());
357
        g_config->get("ohmanufacturername", ohProductDesc.manufacturer.name);
359
        g_config->get("ohmanufacturername", ohProductDesc.manufacturer.name);
358
        g_config->get("ohmanufacturerinfo", ohProductDesc.manufacturer.info);
360
        g_config->get("ohmanufacturerinfo", ohProductDesc.manufacturer.info);
359
        g_config->get("ohmanufacturerurl", ohProductDesc.manufacturer.url);
361
        g_config->get("ohmanufacturerurl", ohProductDesc.manufacturer.url);
...
...
660
        opts.options |= UpMpd::upmpdOhMetaPersist;
662
        opts.options |= UpMpd::upmpdOhMetaPersist;
661
    if (!sc2mpdpath.empty()) {
663
    if (!sc2mpdpath.empty()) {
662
        opts.sc2mpdpath = sc2mpdpath;
664
        opts.sc2mpdpath = sc2mpdpath;
663
        opts.options |= UpMpd::upmpdOhReceiver;
665
        opts.options |= UpMpd::upmpdOhReceiver;
664
    }
666
    }
667
    if (!screceiverstatefile.empty()) {
668
        opts.screceiverstatefile = screceiverstatefile;
669
        int fd;
670
        if ((fd = open(opts.screceiverstatefile.c_str(),
671
                       O_CREAT|O_RDWR, 0644)) < 0) {
672
            LOGERR("creat(" << opts.screceiverstatefile << ") : errno : "
673
                   << errno << endl);
674
        } else {
675
            close(fd);
676
            if (geteuid() == 0 && chown(opts.screceiverstatefile.c_str(),
677
                                        runas, -1) != 0) {
678
                LOGERR("chown(" << opts.screceiverstatefile << ") : errno : "
679
                       << errno << endl);
680
            }
681
        }
682
    }
665
    if (!senderpath.empty()) {
683
    if (!senderpath.empty()) {
666
        opts.options |= UpMpd::upmpdOhSenderReceiver;
684
        opts.options |= UpMpd::upmpdOhSenderReceiver;
667
        opts.senderpath = senderpath;
685
        opts.senderpath = senderpath;
668
        opts.sendermpdport = sendermpdport;
686
        opts.sendermpdport = sendermpdport;
669
    }
687
    }