From 36592fd1af2b591a09ce61fb8701a6a8855aac27 Mon Sep 17 00:00:00 2001 From: Natalia Portillo Date: Wed, 28 Apr 2021 09:22:08 +0100 Subject: [PATCH] Fix creation of extended attributes in BeOS. --- setter/src/beos/xattr.c | 38 ++++++++++++-------------------------- 1 file changed, 12 insertions(+), 26 deletions(-) diff --git a/setter/src/beos/xattr.c b/setter/src/beos/xattr.c index 6795b08..ede5708 100644 --- a/setter/src/beos/xattr.c +++ b/setter/src/beos/xattr.c @@ -26,8 +26,6 @@ Copyright (C) 2011-2021 Natalia Portillo #include #include #include -#include -#include #include #include "xattr.h" @@ -76,19 +74,13 @@ void ExtendedAttributes(const char* path) else { fprintf(file, "This file has an extended attribute called \"comment\" that is 34 bytes long.\n"); + attr_fd = fileno(file); + + cRc = fs_write_attr(attr_fd, "comment", B_STRING_TYPE, 0, stringAttribute, 34); + + cRc = cRc < 0 ? errno : 0; + fclose(file); - attr_fd = fs_open_attr("comment", "comment", B_STRING_TYPE, O_RDWR); - - if(attr_fd >= 0) - { - cRc = fs_write_attr(attr_fd, "comment", B_STRING_TYPE, 0, stringAttribute, 34); - - cRc = cRc < 0 ? errno : 0; - - fs_close_attr(attr_fd); - } - else - rc = errno; } log_write("\tFile with an extended attribute called \"comment\", rc = %d, cRc = %d\n", rc, cRc); @@ -99,19 +91,13 @@ void ExtendedAttributes(const char* path) else { fprintf(file, "This file has an extended attribute called \"comment\" that is 34 bytes long.\n"); + attr_fd = fileno(file); + + cRc = fs_write_attr(attr_fd, "BEOS:L:STD_ICON", B_LARGE_ICON_TYPE, 0, iconAttribute, 1024); + + cRc = cRc < 0 ? errno : 0; + fclose(file); - attr_fd = fs_open_attr("icon", "BEOS:L:STD_ICON", B_LARGE_ICON_TYPE, O_RDWR); - - if(attr_fd >= 0) - { - cRc = fs_write_attr(attr_fd, "BEOS:L:STD_ICON", B_LARGE_ICON_TYPE, 0, iconAttribute, 1024); - - cRc = cRc < 0 ? errno : 0; - - fs_close_attr(attr_fd); - } - else - rc = errno; } log_write("\tFile with an extended attribute called \"BEOS:L:STD_ICON\", rc = %d, cRc = %d\n", rc, cRc); }