ChmodFile.cpp

См. документацию.
00001 /* 
00002  * File:   chmodFile.cpp
00003  * Author: nick
00004  * 
00005  * Created on 26 Сентябрь 2011 г., 19:59
00006  */
00007 
00008 #include "ChmodFile.h"
00009 
00010 #include <errno.h>
00011 
00012 int ChmodFile::fileFunc(Chmod* filetag){
00013     cout<<"C1"<<endl;
00014     int res=-1;
00015     mode_t mt;
00016     cout<<"C2"<<endl;
00017     string fn=sc->getSharedDir()+filetag->getFile(mt);
00018     cout<<"C3"<<endl;
00019     GlobalData* gd=GlobalData::get_Instance();
00020     cout<<"C4"<<endl;
00021     if(chmod(fn.data(),mt)<0){
00022         cout<<"C5"<<endl;
00023         //3. если не удалится то вернуть -ERRNO
00024         res=-errno;
00025     }else{
00026         cout<<"C6"<<endl;
00027         //Если все хорошо вернуть 0
00028         res= 0;
00029     }
00030     cout<<"C7"<<endl;
00031     //4. если есть, то вернуть -1    
00032     return res;
00033 }