diff options
author | Markus Uhlin <markus@nifty-networks.net> | 2025-03-15 16:28:50 +0100 |
---|---|---|
committer | Markus Uhlin <markus@nifty-networks.net> | 2025-03-15 16:28:50 +0100 |
commit | 2e6af510e4aae8ecf1dbe053a8c0b97c04fb1b39 (patch) | |
tree | e78140bbbc1d4093c031d32a3ae99698ce738c2d /FICS/playerdb.c | |
parent | 8f06fc061615dad45579cb5795ef54969286ac14 (diff) |
Added xrename()
Diffstat (limited to 'FICS/playerdb.c')
-rw-r--r-- | FICS/playerdb.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/FICS/playerdb.c b/FICS/playerdb.c index f84dfe4..2e53076 100644 --- a/FICS/playerdb.c +++ b/FICS/playerdb.c @@ -75,6 +75,21 @@ player_num_ok_chk(const int num) num < (int)ARRAY_SIZE(parray)); } +PUBLIC void +xrename(const char *fn, const char *name1, const char *name2) +{ + if (fn == NULL || name1 == NULL || name2 == NULL) { + errno = EINVAL; + warn("%s", __func__); + return; + } + + errno = 0; + + if (rename(name1, name2) != 0) + warn("%s: '%s' -> '%s'", fn, name1, name2); +} + PRIVATE int get_empty_slot(void) { |