mirror of
				https://github.com/vdr-projects/vdr.git
				synced 2025-03-01 10:50:46 +00:00 
			
		
		
		
	Fixed dropping capabilities in case cap_sys_time is not available
This commit is contained in:
		
							
								
								
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							
							
						
						
									
										1
									
								
								HISTORY
									
									
									
									
									
								
							@@ -9430,3 +9430,4 @@ Video Disk Recorder Revision History
 | 
			
		||||
  in SCR systems, and Helmut Binder for helping with the implementation).
 | 
			
		||||
- Fixed compatibility with current versions of glibc (thanks to Manuel Reimer).
 | 
			
		||||
- The SVDRP command DELC now also accepts a channel id (suggested by Manuel Reimer).
 | 
			
		||||
- Fixed dropping capabilities in case cap_sys_time is not available.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										18
									
								
								vdr.c
									
									
									
									
									
								
							
							
						
						
									
										18
									
								
								vdr.c
									
									
									
									
									
								
							@@ -22,7 +22,7 @@
 | 
			
		||||
 *
 | 
			
		||||
 * The project's page is at http://www.tvdr.de
 | 
			
		||||
 *
 | 
			
		||||
 * $Id: vdr.c 4.30 2019/05/23 09:48:35 kls Exp $
 | 
			
		||||
 * $Id: vdr.c 4.31 2020/05/07 10:45:41 kls Exp $
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <getopt.h>
 | 
			
		||||
@@ -131,20 +131,18 @@ static bool DropCaps(void)
 | 
			
		||||
     fprintf(stderr, "vdr: cap_get_proc failed: %s\n", strerror(errno));
 | 
			
		||||
     return false;
 | 
			
		||||
     }
 | 
			
		||||
  char *caps_text = cap_to_text(caps_all, NULL);
 | 
			
		||||
  if (!caps_text) {
 | 
			
		||||
     fprintf(stderr, "vdr: cap_to_text failed: %s\n", strerror(errno));
 | 
			
		||||
     return false;
 | 
			
		||||
     }
 | 
			
		||||
  if (cap_free(caps_all)) {
 | 
			
		||||
     fprintf(stderr, "vdr: cap_free failed: %s\n", strerror(errno));
 | 
			
		||||
  cap_flag_value_t cap_flag_value;
 | 
			
		||||
  if (cap_get_flag(caps_all, CAP_SYS_TIME, CAP_PERMITTED , &cap_flag_value)) {
 | 
			
		||||
     fprintf(stderr, "vdr: cap_get_flag failed: %s\n", strerror(errno));
 | 
			
		||||
     return false;
 | 
			
		||||
     }
 | 
			
		||||
  cap_t caps;
 | 
			
		||||
  if (strstr(caps_text,"cap_sys_time"))
 | 
			
		||||
  if (cap_flag_value == CAP_SET)
 | 
			
		||||
     caps = cap_from_text("= cap_sys_nice,cap_sys_time,cap_net_raw=ep");
 | 
			
		||||
  else
 | 
			
		||||
  else {
 | 
			
		||||
     fprintf(stdout,"vdr: OS does not support cap_sys_time\n");
 | 
			
		||||
     caps = cap_from_text("= cap_sys_nice,cap_net_raw=ep");
 | 
			
		||||
     }
 | 
			
		||||
  if (!caps) {
 | 
			
		||||
     fprintf(stderr, "vdr: cap_from_text failed: %s\n", strerror(errno));
 | 
			
		||||
     return false;
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user