Fix some bugs (hopefully)

Signed-off-by: AnErrupTion <anerruption@disroot.org>
pull/597/head
AnErrupTion 6 months ago
parent c03e2e6b87
commit 74556479db
No known key found for this signature in database
GPG Key ID: 3E85EB44F610AD7F

@ -80,6 +80,9 @@ pub fn main() !void {
}
// Initialize information line with host name
var got_host_name = false;
var host_name_buffer: []u8 = undefined;
get_host_name: {
const host_name_struct = interop.getHostName(allocator) catch |err| {
if (err == error.CannotGetHostName) {
@ -89,8 +92,9 @@ pub fn main() !void {
}
break :get_host_name;
};
defer allocator.free(host_name_struct.buffer);
got_host_name = true;
host_name_buffer = host_name_struct.buffer;
info_line = host_name_struct.slice;
}
@ -134,14 +138,14 @@ pub fn main() !void {
const reader = file.reader();
const username_length = try reader.readIntLittle(u64);
const username_buffer = try file.readToEndAlloc(allocator, username_length);
const username_buffer = try reader.readAllAlloc(allocator, username_length);
defer allocator.free(username_buffer);
_ = try reader.read(username_buffer);
const current_desktop = try reader.readIntLittle(u64);
const load_buffer = try file.readToEndAlloc(allocator, config.ly.max_login_len + 5);
const load_buffer = try reader.readAllAlloc(allocator, config.ly.max_login_len + 5);
defer allocator.free(load_buffer);
if (username_buffer.len > 0) {
@ -509,6 +513,8 @@ pub fn main() !void {
}
}
if (got_host_name) allocator.free(host_name_buffer);
if (shutdown) {
return std.process.execv(allocator, &[_][]const u8{ "/bin/sh", "-c", config.ly.shutdown_cmd });
} else if (restart) {

@ -103,7 +103,7 @@ pub fn addEnvironmentWithBuffer(self: *Desktop, entry_buffer: []u8, name: []cons
}
pub fn crawl(self: *Desktop, path: []const u8, display_server: DisplayServer) !void {
var directory = try std.fs.openDirAbsolute(path, .{});
var directory = std.fs.openDirAbsolute(path, .{}) catch return;
defer directory.close();
var iterable_directory = try std.fs.openIterableDirAbsolute(path, .{});

Loading…
Cancel
Save