VDR 1.3.38 and "-u root"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I demand that Oliver Friedrich may or may not have written...

[snip]
> And with 1.3.38 it is impossible to simply get the commandline help if
> no useraccount 'vdr' is present on the system and the user doesn't know
> the '-u' switch ...

The attached patch (or something similar) should help.

-- 
| Darren Salt | d youmustbejoking,demon,co,uk | nr. Ashington,
| Debian,     | s zap,tartarus,org            | Northumberland
| RISC OS     | @                             | Toon Army
|   <URL:http://www.youmustbejoking.demon.co.uk/progs.packages.html>

The disks are getting full; purge a file today.
-------------- next part --------------
diff -urNad vdr-1.3.38~/vdr.c vdr-1.3.38/vdr.c
--- vdr-1.3.38~/vdr.c	2006-01-09 15:08:26.000000000 +0000
+++ vdr-1.3.38/vdr.c	2006-01-09 15:08:26.780107092 +0000
@@ -35,6 +35,7 @@
 #include <sys/prctl.h>
 #include <termios.h>
 #include <unistd.h>
+#include <sys/types.h>
 #include "audio.h"
 #include "channels.h"
 #include "config.h"
@@ -151,6 +152,9 @@
   // Save terminal settings:
 
   struct termios savedTm;
+
+  bool isroot = !getuid ();// || !getgid () || !geteuid () || !getegid ();
+  
   bool HasStdin = (tcgetpgrp(STDIN_FILENO) == getpid() || getppid() != (pid_t)1) && tcgetattr(STDIN_FILENO, &savedTm) == 0;
 
   // Initiate locale:
@@ -226,6 +230,16 @@
     };
 
   int c;
+  if (isroot)
+  while ((c = getopt_long(argc, argv, "a:c:dD:E:g:hl:L:mp:P:r:s:t:u:v:Vw:", long_options, NULL)) != -1) {
+        switch (c) {
+          case 'h': DisplayHelp = true;
+                    break;
+          case 'V': DisplayVersion = true;
+                    break;
+          }
+        }
+  else
   while ((c = getopt_long(argc, argv, "a:c:dD:E:g:hl:L:mp:P:r:s:t:u:v:Vw:", long_options, NULL)) != -1) {
         switch (c) {
           case 'a': AudioCommand = optarg;
@@ -349,14 +363,17 @@
         return 2;
      if (!SetCapSysTime())
         return 2;
+     isroot = false;
      }
 
   // Help and version info:
 
   if (DisplayHelp || DisplayVersion) {
+    if (!isroot) {
      if (!PluginManager.HasPlugins())
         PluginManager.AddPlugin("*"); // adds all available plugins
      PluginManager.LoadPlugins();
+    }
      if (DisplayHelp) {
         printf("Usage: vdr [OPTIONS]\n\n"          // for easier orientation, this is column 80|
                "  -a CMD,   --audio=CMD    send Dolby Digital audio to stdin of command CMD\n"
@@ -415,7 +432,7 @@
         }
      if (DisplayVersion)
         printf("vdr (%s) - The Video Disk Recorder\n", VDRVERSION);
-     if (PluginManager.HasPlugins()) {
+     if (!isroot && PluginManager.HasPlugins()) {
         if (DisplayHelp)
            printf("Plugins: vdr -P\"name [OPTIONS]\"\n\n");
         for (int i = 0; ; i++) {

[Index of Archives]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Util Linux NG]     [Xfree86]     [Big List of Linux Books]     [Fedora Users]     [Fedora Women]     [ALSA Devel]     [Linux USB]

  Powered by Linux