mirror of
				https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
				synced 2025-11-03 09:01:50 -05:00 
			
		
		
		
	add proper locking when accessing the file match.table
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@906 fefdeb5f-60dc-0310-8127-8f9354f1896f
This commit is contained in:
		
							parent
							
								
									e0bf4a32f3
								
							
						
					
					
						commit
						1cfb01ab0e
					
				
					 1 changed files with 6 additions and 1 deletions
				
			
		| 
						 | 
					@ -39,6 +39,7 @@
 | 
				
			||||||
#include <polypcore/core-subscribe.h>
 | 
					#include <polypcore/core-subscribe.h>
 | 
				
			||||||
#include <polypcore/xmalloc.h>
 | 
					#include <polypcore/xmalloc.h>
 | 
				
			||||||
#include <polypcore/sink-input.h>
 | 
					#include <polypcore/sink-input.h>
 | 
				
			||||||
 | 
					#include <polypcore/util.h>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
#include "module-match-symdef.h"
 | 
					#include "module-match-symdef.h"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -88,6 +89,8 @@ static int load_rules(struct userdata *u, const char *filename) {
 | 
				
			||||||
        goto finish;
 | 
					        goto finish;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    pa_lock_fd(fileno(f), 1);
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
    while (!feof(f)) {
 | 
					    while (!feof(f)) {
 | 
				
			||||||
        char *d, *v;
 | 
					        char *d, *v;
 | 
				
			||||||
        pa_volume_t volume;
 | 
					        pa_volume_t volume;
 | 
				
			||||||
| 
						 | 
					@ -146,8 +149,10 @@ static int load_rules(struct userdata *u, const char *filename) {
 | 
				
			||||||
    ret = 0;
 | 
					    ret = 0;
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
finish:
 | 
					finish:
 | 
				
			||||||
    if (f)
 | 
					    if (f) {
 | 
				
			||||||
 | 
					        pa_lock_fd(fileno(f), 0);
 | 
				
			||||||
        fclose(f);
 | 
					        fclose(f);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (fn)
 | 
					    if (fn)
 | 
				
			||||||
        pa_xfree(fn);
 | 
					        pa_xfree(fn);
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue