1 --- lightdm-1.19.3/src/session-child.c.~6~ 2016-08-12 20:29:20.896781907 +0300
2 +++ lightdm-1.19.3/src/session-child.c 2016-08-12 20:34:18.800499967 +0300
7 +#include <sys/soundcard.h>
12 #include "x-authority.h"
13 #include "configuration.h"
15 +#define MAX_HOSTNAME 256
17 /* Child process being run */
18 static GPid child_pid = 0;
21 privileges_reclaim ();
25 + /usr/bin/audioctl save-controls -d $AUDIOCTL_SAVE_DEVICE \
26 + -f $AUDIOCTL_SAVE_DIR/audioctl-$AUDIOCTL_SAVE_HOSTNAME-$AUDIOCTL_SAVE_DEVICE
28 +#define AUDIO_SETTINGS_SAVE "/usr/bin/audioctl save-controls -d %s -f \"%s/audioctl-%s-%s\""
31 +save_audio_settings(User *user)
33 + char hostname[MAX_HOSTNAME];
34 + char *user_name,*save_dir;
36 + struct stat st,st_sd;
38 + if(gethostname(hostname,MAX_HOSTNAME))
41 + user_name=user_get_name(user);
42 + pwd=getpwnam(user_name);
43 + if(pwd == NULL || pwd->pw_dir == NULL)
46 + if(stat("/dev/audio", &st))
49 + if(st.st_uid == user_get_uid(user)) {
50 + gboolean drop_privileges;
54 + drop_privileges = geteuid () == 0;
55 + if (drop_privileges)
56 + privileges_drop (user_get_uid (user), user_get_gid (user));
58 + save_dir=g_strdup_printf("%s/.audioctl", pwd->pw_dir);
62 + if(stat(save_dir, &st_sd)) {
63 + if(mkdir(save_dir, S_IRWXU)){
69 + if ((fd = open("/dev/mixer", O_RDWR)) < 0){
74 + if (ioctl(fd, SNDCTL_SYSINFO, &si) < 0) {
79 + for (i = 0; i < si.nummixers; i++) {
81 + oss_mixerinfo mixer;
85 + if (ioctl(fd, SNDCTL_MIXERINFO, &mixer) != 0)
88 + command=g_strdup_printf(AUDIO_SETTINGS_SAVE, mixer.name, save_dir, hostname, mixer.name);
93 + if (drop_privileges)
94 + privileges_reclaim ();
105 run_linc_cleanup(user);
107 + if (g_strcmp0 (pam_getenv (pam_handle, "XDG_SESSION_CLASS"), "greeter") != 0)
108 + save_audio_settings(user);
110 if (!remote_host_name && !g_strcmp0(xdisplay,":0") && (g_str_has_prefix (tty, "/dev/vt/") || !g_strcmp0(tty,"/dev/console"))){
111 di_devperm_logout (tty);