diff options
author | unknown <monty@narttu.mysql.fi> | 2003-03-10 12:48:43 +0200 |
---|---|---|
committer | unknown <monty@narttu.mysql.fi> | 2003-03-10 12:48:43 +0200 |
commit | 012ffb5d505cc563ae980bd8cbee9b668f517cac (patch) | |
tree | 8651694def257832c6e225eead2eec4c5a7c9aeb /mysys/my_copy.c | |
parent | 66e8db8241bfcad048d08fa1a24532fae8ee5f0a (diff) | |
parent | 73c2d4ad498890c2ba2cfa9a2c20fae4d37b1859 (diff) | |
download | mariadb-git-012ffb5d505cc563ae980bd8cbee9b668f517cac.tar.gz |
Merge with 3.23 to get fixes for --user and BACKUP TABLE
BitKeeper/etc/ignore:
auto-union
BitKeeper/deleted/.del-delete.result:
Delete: mysql-test/r/delete.result
BitKeeper/deleted/.del-stamp-h.in~4a5d6676232516c5:
Auto merged
client/mysqlbinlog.cc:
Auto merged
include/my_sys.h:
Auto merged
libmysql/libmysql.c:
Auto merged
mysql-test/t/delete.test:
Auto merged
mysql-test/t/join.test:
Auto merged
mysql-test/t/type_datetime.test:
Auto merged
mysys/my_copy.c:
Auto merged
sql/field.h:
Auto merged
sql/opt_range.cc:
Auto merged
sql/share/polish/errmsg.txt:
Auto merged
sql/sql_rename.cc:
Auto merged
sql/sql_select.cc:
Auto merged
mysql-test/mysql-test-run.sh:
merge with 3.23.56
mysql-test/r/backup.result:
merge (needs to be updated)
mysql-test/r/join.result:
merge (needs to be updated)
mysql-test/r/type_datetime.result:
merge (needs to be updated)
mysql-test/t/backup.test:
merge with 3.23
scripts/mysqld_safe.sh:
Only use first --user option
sql/ha_myisam.cc:
Don't let BACKUP TABLE overwrite old files
sql/log_event.h:
merge
sql/mysql_priv.h:
merge
sql/mysqld.cc:
Use first --user option
sql/slave.cc:
use local version
sql/sql_repl.h:
use local version
Diffstat (limited to 'mysys/my_copy.c')
-rw-r--r-- | mysys/my_copy.c | 30 |
1 files changed, 22 insertions, 8 deletions
diff --git a/mysys/my_copy.c b/mysys/my_copy.c index 012eaec4ea8..84eda781a09 100644 --- a/mysys/my_copy.c +++ b/mysys/my_copy.c @@ -31,17 +31,29 @@ struct utimbuf { #endif - /* - Ordinary ownership and accesstimes are copied from 'from-file' - if MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then - the modes of to-file isn't changed - Dont set MY_FNABP or MY_NABP bits on when calling this function ! - */ +/* + int my_copy(const char *from, const char *to, myf MyFlags) + + NOTES + Ordinary ownership and accesstimes are copied from 'from-file' + If MyFlags & MY_HOLD_ORIGINAL_MODES is set and to-file exists then + the modes of to-file isn't changed + If MyFlags & MY_DONT_OVERWRITE_FILE is set, we will give an error + if the file existed. + + WARNING + Don't set MY_FNABP or MY_NABP bits on when calling this function ! + + RETURN + 0 ok + # Error + +*/ int my_copy(const char *from, const char *to, myf MyFlags) { uint Count; - int new_file_stat; + int new_file_stat, create_flag; File from_file,to_file; char buff[IO_SIZE]; struct stat stat_buff,new_stat_buff; @@ -62,8 +74,10 @@ int my_copy(const char *from, const char *to, myf MyFlags) } if (MyFlags & MY_HOLD_ORIGINAL_MODES && !new_file_stat) stat_buff=new_stat_buff; + create_flag= (MyFlags & MY_DONT_OVERWRITE_FILE) ? O_EXCL : O_TRUNC; + if ((to_file= my_create(to,(int) stat_buff.st_mode, - O_WRONLY | O_TRUNC | O_BINARY | O_SHARE, + O_WRONLY | create_flag | O_BINARY | O_SHARE, MyFlags)) < 0) goto err; |