Commit ddbab649 authored by jan.koester's avatar jan.koester
Browse files

test

parent 6ff47d00
Loading
Loading
Loading
Loading
+8 −3
Changes for commands/filesystem/cp.cpp: 8 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -144,13 +144,18 @@ namespace fresh { namespace cmd {
                    // recreate the source's directory part below dst
                    std::string rel=s;
                    while(!rel.empty() && rel[0]=='/') rel.erase(0,1);
                    std::string cur=dst;
                    // new intermediate directories take the source directory's mode
                    std::string cur=dst,srcDir=s[0]=='/' ? "" : ".";
                    size_t p=0;
                    while(true){
                        size_t sl=rel.find('/',p);
                        if(sl==std::string::npos) break;
                        cur+="/"+rel.substr(p,sl-p);
                        mkdir(cur.c_str(),0755);
                        std::string comp=rel.substr(p,sl-p);
                        cur+="/"+comp;
                        srcDir+="/"+comp;
                        struct stat ds;
                        if(stat(srcDir.c_str(),&ds)!=0) ds.st_mode=0755;
                        if(mkdir(cur.c_str(),0700)==0) chmod(cur.c_str(),o.keepMode ? (ds.st_mode&07777) : (ds.st_mode&0777&~cp.umaskBits));
                        p=sl+1;
                    }
                    target=dst+"/"+rel;
+7 −0
Changes for commands/filesystem/ln.cpp: 7 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -115,6 +115,13 @@ namespace fresh { namespace cmd {
                    return false;
                }
            }
            if(!symbolic){
                struct stat ts;
                if(stat(target.c_str(),&ts)==0 && S_ISDIR(ts.st_mode)){
                    std::cerr << "ln: " << target << ": hard link not allowed for directory" << std::endl;
                    return false;
                }
            }
            int r=symbolic ? symlink(tgt.c_str(),name.c_str())
                           : linkat(AT_FDCWD,target.c_str(),AT_FDCWD,name.c_str(),logical ? AT_SYMLINK_FOLLOW : 0);
            if(r!=0){