1/* chmod.c 2 Change the mode of a file. */ 3 4#include "uucp.h" 5 6#include "uudefs.h" 7#include "sysdep.h" 8#include "system.h" 9 10#include <errno.h> 11 12/* Change the mode of a file. */ 13 14boolean 15fsysdep_change_mode (zfile, imode) 16 const char *zfile; 17 unsigned int imode; 18{ 19 char rfile[PATH_MAX]; 20 21#ifdef WORLD_WRITABLE_FILE_IN 22 realpath(zfile, rfile); 23 if (rfile == strstr(rfile, WORLD_WRITABLE_FILE_IN)) { 24 imode |= S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH; 25 } 26#endif 27 28 if (chmod ((char *) zfile, imode) < 0) 29 { 30 ulog (LOG_ERROR, "chmod (%s): %s", zfile, strerror (errno)); 31 return FALSE; 32 } 33 return TRUE; 34} 35