| 1 | /* Copyright (C) 2000 MySQL AB | 
| 2 |  | 
| 3 |    This program is free software; you can redistribute it and/or modify | 
| 4 |    it under the terms of the GNU General Public License as published by | 
| 5 |    the Free Software Foundation; version 2 of the License. | 
| 6 |  | 
| 7 |    This program is distributed in the hope that it will be useful, | 
| 8 |    but WITHOUT ANY WARRANTY; without even the implied warranty of | 
| 9 |    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
| 10 |    GNU General Public License for more details. | 
| 11 |  | 
| 12 |    You should have received a copy of the GNU General Public License | 
| 13 |    along with this program; if not, write to the Free Software | 
| 14 |    Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA */ | 
| 15 |  | 
| 16 | #include "mysys_priv.h" | 
| 17 | #include "mysys_err.h" | 
| 18 |  | 
| 19 | /** | 
| 20 |    @brief Change mode of file. | 
| 21 |  | 
| 22 |    @fn my_chmod() | 
| 23 |    @param name  	Filename | 
| 24 |    @param mode_t        Mode | 
| 25 |    @param my_flags	Flags | 
| 26 |  | 
| 27 |    @notes | 
| 28 |    The  mode of the file given by path or referenced by fildes is changed | 
| 29 |  | 
| 30 |    @retval 0	Ok | 
| 31 |    @retval #	Error | 
| 32 | */ | 
| 33 |  | 
| 34 | int my_chmod(const char *name, mode_t mode, myf my_flags) | 
| 35 | { | 
| 36 |   DBUG_ENTER("my_chmod" ); | 
| 37 |   DBUG_PRINT("my" ,("name: %s  mode: %lu  flags: %lu" , name, (ulong) mode, | 
| 38 |                    my_flags)); | 
| 39 |  | 
| 40 |   if (chmod(name, mode)) | 
| 41 |   { | 
| 42 |     my_errno= errno; | 
| 43 |     if (my_flags & MY_WME) | 
| 44 |       my_error(EE_CANT_CHMOD, MYF(0), name, (ulong) mode, my_errno); | 
| 45 |     DBUG_RETURN(1); | 
| 46 |   } | 
| 47 |   DBUG_RETURN(0); | 
| 48 | } | 
| 49 |  |