X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=blobdiff_plain;f=etc%2Fafpd%2Fdesktop.c;h=9ba96bc595fd5562be47886acae0aba4238dccf2;hp=f34729cc48e00cd32b6a6c5816bb21e46a1e576f;hb=3a43b6ca05ec2b8f0494f8619a82d25204b7b457;hpb=4e9103b8f614e81a66f4c21511cc8b97f25111c9 diff --git a/etc/afpd/desktop.c b/etc/afpd/desktop.c index f34729cc..9ba96bc5 100644 --- a/etc/afpd/desktop.c +++ b/etc/afpd/desktop.c @@ -31,6 +31,7 @@ #include #include #include +#include #include #include "volume.h" @@ -61,7 +62,7 @@ int setdeskmode(const struct vol *vol, const mode_t mode) bstring dtpath = bfromcstr(vol->v_dbpath); bcatcstr(dtpath, "/" APPLEDESKTOP); - EC_NEG1( chdir(bdata(dtpath)) ); + EC_NEG1( chdir(cfrombstr(dtpath)) ); if (( desk = opendir( "." )) == NULL ) { if ( chdir( wd ) < 0 ) { @@ -138,7 +139,7 @@ int setdeskowner(const struct vol *vol, uid_t uid, gid_t gid) bstring dtpath = bfromcstr(vol->v_dbpath); bcatcstr(dtpath, "/" APPLEDESKTOP); - EC_NEG1( chdir(bdata(dtpath)) ); + EC_NEG1( chdir(cfrombstr(dtpath)) ); if (( desk = opendir( "." )) == NULL ) { if ( chdir( wd ) < 0 ) { @@ -182,7 +183,7 @@ int setdeskowner(const struct vol *vol, uid_t uid, gid_t gid) LOG(log_error, logtype_afpd, "setdeskowner: chdir %s: %s", wd, strerror(errno) ); EC_FAIL; } - if (chown(bdata(dtpath), uid, gid ) < 0 && errno != EPERM ) { + if (chown(cfrombstr(dtpath), uid, gid ) < 0 && errno != EPERM ) { LOG(log_error, logtype_afpd, "setdeskowner: chown %s: %s", fullpathname(".AppleDouble"), strerror(errno) ); } @@ -203,11 +204,11 @@ static void create_appledesktop_folder(const struct vol * vol) dtpath = bfromcstr(vol->v_dbpath); bcatcstr(dtpath, "/" APPLEDESKTOP); - if (lstat(bdata(dtpath), &st) != 0) { + if (lstat(cfrombstr(dtpath), &st) != 0) { become_root(); - if (lstat(bdata(olddtpath), &st) == 0) { + if (lstat(cfrombstr(olddtpath), &st) == 0) { cmd_argv[0] = "mv"; cmd_argv[1] = bdata(olddtpath); cmd_argv[2] = bdata(dtpath); @@ -215,10 +216,10 @@ static void create_appledesktop_folder(const struct vol * vol) if (run_cmd("mv", cmd_argv) != 0) { LOG(log_error, logtype_afpd, "moving .AppleDesktop from \"%s\" to \"%s\" failed", bdata(olddtpath), bdata(dtpath)); - mkdir(bdata(dtpath), 0777); + mkdir(cfrombstr(dtpath), 0777); } } else { - mkdir(bdata(dtpath), 0777); + mkdir(cfrombstr(dtpath), 0777); } unbecome_root();