|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Dec 2002
Città: Pordenone
Messaggi: 556
|
permessi file
Ciao a tutti,
come faccio a verificare che un file abbia i diritti di esecuzione?? c'è un modo diretto senza usare script? Linguaggio di programmazione: C Sistema operativo: LINUX HELP PLZ Grazie
__________________
My config-> Cpu: Amd_64 3000MHz; Mobo:Chaintech Znf3 Zenith; Ram:: 1024MB DDR400 Kingston Scheda video: Asus 7600gs; HDD: 2x Segate 80gb with raid1, 1x Maxtor 80gb; Lettori ottici: DVD Plextor px-116A, DVD+RW LG, Monitor: ViewSonic VX900, Stampante OKI C5300. |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Oct 2001
Messaggi: 11471
|
puoi usare la funzione stat (man 2 stat). piu precisamente dovresti guardare il campo st_mode
ciao |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Dec 2002
Città: Pordenone
Messaggi: 556
|
Grazie 1000...
ti chiedo un ultimo piacere... entro sta sera devo consegnare un progetto e non ho tempo per fare prove con questo comando... mi scriveresti due righe di codice per verificare se ho i diritti di esecuzione su un file di nome "xxx.out" ?? GRAZIE 1000
__________________
My config-> Cpu: Amd_64 3000MHz; Mobo:Chaintech Znf3 Zenith; Ram:: 1024MB DDR400 Kingston Scheda video: Asus 7600gs; HDD: 2x Segate 80gb with raid1, 1x Maxtor 80gb; Lettori ottici: DVD Plextor px-116A, DVD+RW LG, Monitor: ViewSonic VX900, Stampante OKI C5300. |
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Oct 2001
Messaggi: 11471
|
Dovrebbe essere qualcosa tipo
Codice:
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
int main (int argc, char **argv)
{
if (argc != 2) return -1;
struct stat s;
if (stat (argv[1], &s) < 0) {
fprintf (stderr, "errore!\n");
} else {
if (s.st_mode & S_IXUSR) {
printf ("il proprietario puo eseguire il file\n");
} else {
printf ("il proprietario non puo eseguire il file\n");
}
}
return 0;
}
|
|
|
|
|
|
#5 |
|
Senior Member
Iscritto dal: Dec 2002
Città: Pordenone
Messaggi: 556
|
non funziona
spiegami cosa dovrebbero restituire st_mode e S_IXUSR per favore... nel man non è spiegato
__________________
My config-> Cpu: Amd_64 3000MHz; Mobo:Chaintech Znf3 Zenith; Ram:: 1024MB DDR400 Kingston Scheda video: Asus 7600gs; HDD: 2x Segate 80gb with raid1, 1x Maxtor 80gb; Lettori ottici: DVD Plextor px-116A, DVD+RW LG, Monitor: ViewSonic VX900, Stampante OKI C5300. |
|
|
|
|
|
#6 |
|
Senior Member
Iscritto dal: Dec 2002
Città: Pordenone
Messaggi: 556
|
risolto lo stesso... grazie 1000 per la dritta
CIAO
__________________
My config-> Cpu: Amd_64 3000MHz; Mobo:Chaintech Znf3 Zenith; Ram:: 1024MB DDR400 Kingston Scheda video: Asus 7600gs; HDD: 2x Segate 80gb with raid1, 1x Maxtor 80gb; Lettori ottici: DVD Plextor px-116A, DVD+RW LG, Monitor: ViewSonic VX900, Stampante OKI C5300. |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 13:53.


















