mirror of
https://github.com/fairyglade/ly.git
synced 2025-12-20 19:24:53 +00:00
Don't crash when failing to crawl a session directory (closes #870)
Signed-off-by: AnErrupTion <anerruption@disroot.org>
This commit is contained in:
@@ -11,6 +11,7 @@ err_brightness_change = فشل في تغيير سطوع الشاشة
|
||||
err_chdir = فشل في فتح مجلد المنزل
|
||||
|
||||
err_config = فشل في تفسير ملف الإعدادات
|
||||
|
||||
err_dgn_oob = رسالة سجل (Log)
|
||||
err_domain = اسم نطاق غير صالح
|
||||
err_empty_password = لا يُسمح بكلمة مرور فارغة
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = error en canviar la brillantor
|
||||
err_chdir = error en obrir la carpeta home
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = missatge de registre
|
||||
err_domain = domini invàlid
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = index je mimo hranice pole
|
||||
err_chdir = nelze otevřít domovský adresář
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = zpráva protokolu
|
||||
err_domain = neplatná doména
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = Helligkeitsänderung fehlgeschlagen
|
||||
err_chdir = Fehler beim Oeffnen des Home-Ordners
|
||||
|
||||
err_config = Fehler beim Verarbeiten der Konfigurationsdatei
|
||||
|
||||
err_dgn_oob = Diagnose-Nachricht
|
||||
err_domain = Ungueltige Domain
|
||||
err_empty_password = Leeres Passwort nicht zugelassen
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = failed to change brightness
|
||||
err_chdir = failed to open home folder
|
||||
err_clock_too_long = clock string too long
|
||||
err_config = unable to parse config file
|
||||
|
||||
err_dgn_oob = log message
|
||||
err_domain = invalid domain
|
||||
err_empty_password = empty password not allowed
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = índice fuera de límites
|
||||
err_chdir = error al abrir la carpeta home
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = mensaje de registro
|
||||
err_domain = dominio inválido
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = échec du changement de luminosité
|
||||
err_chdir = échec de l'ouverture du répertoire home
|
||||
err_clock_too_long = chaîne de formattage de l'horloge trop longue
|
||||
err_config = échec de lecture du fichier de configuration
|
||||
err_crawl = échec de la navigation des répertoires de session
|
||||
err_dgn_oob = message
|
||||
err_domain = domaine invalide
|
||||
err_empty_password = mot de passe vide non autorisé
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = indice fuori limite
|
||||
err_chdir = impossibile aprire home directory
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = messaggio log
|
||||
err_domain = dominio non valido
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = 明るさの変更に失敗しました
|
||||
err_chdir = ホームフォルダを開けませんでした
|
||||
|
||||
err_config = 設定ファイルを解析できません
|
||||
|
||||
err_dgn_oob = ログメッセージ
|
||||
err_domain = 無効なドメイン
|
||||
err_empty_password = 空のパスワードは許可されていません
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = neizdevās mainīt spilgtumu
|
||||
err_chdir = neizdevās atvērt mājas mapi
|
||||
err_clock_too_long = pulksteņa virkne pārāk gara
|
||||
err_config = neizdevās parsēt konfigurācijas failu
|
||||
|
||||
err_dgn_oob = žurnāla ziņojums
|
||||
err_domain = nederīgs domēns
|
||||
err_empty_password = tukša parole nav atļauta
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = nie udało się zmienić jasności
|
||||
err_chdir = nie udało się otworzyć folderu domowego
|
||||
err_clock_too_long = ciąg znaków zegara jest za długi
|
||||
err_config = nie można przetworzyć pliku konfiguracyjnego
|
||||
|
||||
err_dgn_oob = wiadomość loga
|
||||
err_domain = niepoprawna domena
|
||||
err_empty_password = puste hasło jest niedozwolone
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = índice fora de limites
|
||||
err_chdir = erro ao abrir a pasta home
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = mensagem de registo
|
||||
err_domain = domínio inválido
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = índice fora de limites
|
||||
err_chdir = não foi possível abrir o diretório home
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = mensagem de log
|
||||
err_domain = domínio inválido
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ capslock = capslock
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
err_pam_abort = tranzacţie pam anulată
|
||||
|
||||
@@ -11,6 +11,7 @@ err_brightness_change = не удалось изменить яркость
|
||||
err_chdir = не удалось открыть домашнюю папку
|
||||
err_clock_too_long = строка часов слишком длинная
|
||||
err_config = не удалось разобрать файл конфигурации
|
||||
|
||||
err_dgn_oob = отладочное сообщение (log)
|
||||
err_domain = неверный домен
|
||||
err_empty_password = пустой пароль не допустим
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = izvan granica indeksa
|
||||
err_chdir = neuspijesno otvaranje home foldera
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = log poruka
|
||||
err_domain = nevazeci domen
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = utanför banan index
|
||||
err_chdir = misslyckades att öppna hemkatalog
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = loggmeddelande
|
||||
err_domain = okänd domän
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = sinirlarin disinda dizin
|
||||
err_chdir = ev klasoru acilamadi
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = log mesaji
|
||||
err_domain = gecersiz etki alani
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = поза межами індексу
|
||||
err_chdir = не вдалося відкрити домашній каталог
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = повідомлення журналу (log)
|
||||
err_domain = недійсний домен
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ err_bounds = 索引越界
|
||||
err_chdir = 无法打开home文件夹
|
||||
|
||||
|
||||
|
||||
err_dgn_oob = 日志消息
|
||||
err_domain = 无效的域
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ err_brightness_change: []const u8 = "failed to change brightness",
|
||||
err_chdir: []const u8 = "failed to open home folder",
|
||||
err_clock_too_long: []const u8 = "clock string too long",
|
||||
err_config: []const u8 = "unable to parse config file",
|
||||
err_crawl: []const u8 = "failed to crawl session directories",
|
||||
err_dgn_oob: []const u8 = "log message",
|
||||
err_domain: []const u8 = "invalid domain",
|
||||
err_empty_password: []const u8 = "empty password not allowed",
|
||||
|
||||
25
src/main.zig
25
src/main.zig
@@ -411,22 +411,37 @@ pub fn main() !void {
|
||||
try info_line.addMessage(hostname, config.bg, config.fg);
|
||||
}
|
||||
|
||||
var has_crawl_error = false;
|
||||
|
||||
// Crawl session directories (Wayland, X11 and custom respectively)
|
||||
var wayland_session_dirs = std.mem.splitScalar(u8, config.waylandsessions, ':');
|
||||
while (wayland_session_dirs.next()) |dir| {
|
||||
try crawl(&session, lang, dir, .wayland);
|
||||
crawl(&session, lang, dir, .wayland) catch |err| {
|
||||
has_crawl_error = true;
|
||||
try log_writer.print("failed to crawl wayland session directory '{s}': {s}\n", .{ dir, @errorName(err) });
|
||||
};
|
||||
}
|
||||
|
||||
if (build_options.enable_x11_support) {
|
||||
var x_session_dirs = std.mem.splitScalar(u8, config.xsessions, ':');
|
||||
while (x_session_dirs.next()) |dir| {
|
||||
try crawl(&session, lang, dir, .x11);
|
||||
crawl(&session, lang, dir, .x11) catch |err| {
|
||||
has_crawl_error = true;
|
||||
try log_writer.print("failed to crawl x11 session directory '{s}': {s}\n", .{ dir, @errorName(err) });
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
var custom_session_dirs = std.mem.splitScalar(u8, config.custom_sessions, ':');
|
||||
while (custom_session_dirs.next()) |dir| {
|
||||
try crawl(&session, lang, dir, .custom);
|
||||
crawl(&session, lang, dir, .custom) catch |err| {
|
||||
has_crawl_error = true;
|
||||
try log_writer.print("failed to crawl custom session directory '{s}': {s}\n", .{ dir, @errorName(err) });
|
||||
};
|
||||
}
|
||||
|
||||
if (has_crawl_error) {
|
||||
try info_line.addMessage(lang.err_crawl, config.error_bg, config.error_fg);
|
||||
}
|
||||
|
||||
if (usernames.items.len == 0) {
|
||||
@@ -1181,7 +1196,9 @@ fn addOtherEnvironment(session: *Session, lang: Lang, display_server: DisplaySer
|
||||
}
|
||||
|
||||
fn crawl(session: *Session, lang: Lang, path: []const u8, display_server: DisplayServer) !void {
|
||||
var iterable_directory = std.fs.openDirAbsolute(path, .{ .iterate = true }) catch return;
|
||||
if (!std.fs.path.isAbsolute(path)) return error.PathNotAbsolute;
|
||||
|
||||
var iterable_directory = try std.fs.openDirAbsolute(path, .{ .iterate = true });
|
||||
defer iterable_directory.close();
|
||||
|
||||
var iterator = iterable_directory.iterate();
|
||||
|
||||
Reference in New Issue
Block a user