aboutsummaryrefslogtreecommitdiffstats
path: root/src/tvtimeconf.c
diff options
context:
space:
mode:
authorvektor <devnull@localhost>2004-09-15 02:54:26 +0000
committervektor <devnull@localhost>2004-09-15 02:54:26 +0000
commit4a8007c83eaa650320fb7c826471c9f35f7ed43b (patch)
tree37a196017cc5888f4a633f79ba4660b745ae5924 /src/tvtimeconf.c
parent8a2574541f35503d1cf73b9d747b37e1a5624f9d (diff)
14 Sep 2004 Billy Biggs <vektor@dumbterm.net>
* tvtime/src/tvtimeconf.c: Don't allow two instances of tvtime to run at the same time (unless they happen to use different config files).
Diffstat (limited to 'src/tvtimeconf.c')
-rw-r--r--src/tvtimeconf.c21
1 files changed, 21 insertions, 0 deletions
diff --git a/src/tvtimeconf.c b/src/tvtimeconf.c
index b8d126a..e72337b 100644
--- a/src/tvtimeconf.c
+++ b/src/tvtimeconf.c
@@ -897,6 +897,7 @@ int config_parse_tvtime_command_line( config_t *ct, int argc, char **argv )
};
int option_index = 0;
int saveoptions = 0;
+ int filename_specified = 0;
char c;
if( argc ) {
@@ -915,6 +916,7 @@ int config_parse_tvtime_command_line( config_t *ct, int argc, char **argv )
case 'l': if( ct->xmltvlanguage ) { free( ct->xmltvlanguage ); }
ct->xmltvlanguage = strdup( optarg ); break;
case 'F': if( ct->config_filename ) free( ct->config_filename );
+ filename_specified = 1;
ct->config_filename = expand_user_path( optarg );
if( ct->config_filename ) {
lfprintf
@@ -945,6 +947,25 @@ int config_parse_tvtime_command_line( config_t *ct, int argc, char **argv )
}
}
+ if( !filename_specified ) {
+ char *fifofile = get_tvtime_fifo_filename( config_get_uid( ct ) );
+ int fifofd;
+
+ if( !fifofile ) {
+ lfprintf( stderr, _("%s: Cannot allocate memory.\n"), argv[ 0 ] );
+ return 0;
+ }
+
+ fifofd = open( fifofile, O_WRONLY | O_NONBLOCK );
+ if( fifofd >= 0 ) {
+ lfprintf( stderr,
+ _("Cannot run two instances of tvtime with the same configuration.\n") );
+ return 0;
+ }
+ close( fifofd );
+ }
+
+
ct->doc = configsave_open( ct->config_filename );
if( ct->doc && saveoptions ) {

Privacy Policy