|
@@ -22,7 +22,10 @@ int printDir(struct dirent** contentsDir, char* path, int nbFile,
|
|
|
|
|
|
//Affiche les fichiers
|
|
|
while(j < nbFile){
|
|
|
- stat(contentsDir[j]->d_name, &info);
|
|
|
+ if(stat(contentsDir[j]->d_name, &info) == ERR){
|
|
|
+ addperror("Erreur stat");
|
|
|
+ return -1;
|
|
|
+ }
|
|
|
/*switch(info.st_mode){
|
|
|
case S_IRUSR:
|
|
|
permission[1] = 'r';
|
|
@@ -82,7 +85,10 @@ void ls(int argc, char* argv[]){
|
|
|
//Time to display
|
|
|
for(i = 1; i < argc; i++){
|
|
|
if(argv[i][0] != '-'){
|
|
|
- stat(argv[i], &info);
|
|
|
+ if(stat(argv[i], &info) == ERR){
|
|
|
+ addperror("Erreur stat");
|
|
|
+ return;
|
|
|
+ }
|
|
|
if(S_ISDIR(info.st_mode)){
|
|
|
nbFile = scandir(argv[i], &contentsDir, 0, alphasort);
|
|
|
if (nbFile < 0) {
|