forked from github/server
Sicherstellen, dass keien hardlinks automatisch übermeiert werden (unlink).
Schnelleres Backup ohne system() mit Hardlinks.
This commit is contained in:
parent
a18ca097b9
commit
945a60a20c
|
@ -718,7 +718,7 @@ typus2race(unsigned char typus)
|
||||||
void
|
void
|
||||||
create_backup(char *file)
|
create_backup(char *file)
|
||||||
{
|
{
|
||||||
#if defined(HAVE_ACCESS)
|
#ifdef HAVE_UNISTD_H
|
||||||
char bfile[MAX_PATH];
|
char bfile[MAX_PATH];
|
||||||
char command[MAX_PATH*2+10];
|
char command[MAX_PATH*2+10];
|
||||||
int c = 1;
|
int c = 1;
|
||||||
|
@ -726,8 +726,7 @@ create_backup(char *file)
|
||||||
sprintf(bfile, "%s.backup%d", file, c);
|
sprintf(bfile, "%s.backup%d", file, c);
|
||||||
c++;
|
c++;
|
||||||
} while(access(bfile, R_OK) == 0);
|
} while(access(bfile, R_OK) == 0);
|
||||||
sprintf(command, "cp %s %s", file, bfile);
|
link(file, bfile);
|
||||||
system(command);
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2017,6 +2016,12 @@ writegame(const char *filename, char quiet)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
sprintf(buf, "%s/%s", datapath(), filename);
|
sprintf(buf, "%s/%s", datapath(), filename);
|
||||||
|
#ifdef HAVE_UNISTD_H
|
||||||
|
if (access(buf, R_OK) == 0) {
|
||||||
|
/* make sure we don't overwrite some hardlinkedfile */
|
||||||
|
unlink(buf);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
F = cfopen(buf, "w");
|
F = cfopen(buf, "w");
|
||||||
if (F==NULL)
|
if (F==NULL)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
|
@ -161,13 +161,13 @@ cinfo_calm(const struct locale * lang, const void * obj, typ_t typ, struct curse
|
||||||
|
|
||||||
assert(typ == TYP_UNIT);
|
assert(typ == TYP_UNIT);
|
||||||
u = (unit *)obj;
|
u = (unit *)obj;
|
||||||
if (c->magician){
|
if (c->magician && c->magician->faction) {
|
||||||
rc = c->magician->irace;
|
rc = c->magician->irace;
|
||||||
f = c->magician->faction;
|
f = c->magician->faction;
|
||||||
if (self != 0) {
|
if (f!=NULL && self != 0) {
|
||||||
sprintf(buf, "%s mag %s", u->name, factionname(f));
|
sprintf(buf, "%s mag %s", u->name, factionname(f));
|
||||||
} else {
|
} else {
|
||||||
sprintf(buf, "%s scheint %s zu mögen", u->name, LOC(f->locale, rc_name(rc, 1)));
|
sprintf(buf, "%s scheint %s zu mögen", u->name, LOC(lang, rc_name(rc, 1)));
|
||||||
}
|
}
|
||||||
scat(". (");
|
scat(". (");
|
||||||
scat(itoa36(c->no));
|
scat(itoa36(c->no));
|
||||||
|
|
|
@ -94,6 +94,7 @@ extern "C" {
|
||||||
|
|
||||||
#if defined(__USE_SVID) || defined(_BSD_SOURCE) || defined(__USE_XOPEN_EXTENDED) || defined(_BE_SETUP_H) || defined(CYGWIN)
|
#if defined(__USE_SVID) || defined(_BSD_SOURCE) || defined(__USE_XOPEN_EXTENDED) || defined(_BE_SETUP_H) || defined(CYGWIN)
|
||||||
# include <unistd.h>
|
# include <unistd.h>
|
||||||
|
# define HAVE_UNISTD_H
|
||||||
# define HAVE_STRCASECMP
|
# define HAVE_STRCASECMP
|
||||||
# define HAVE_STRNCASECMP
|
# define HAVE_STRNCASECMP
|
||||||
# define HAVE_ACCESS
|
# define HAVE_ACCESS
|
||||||
|
|
|
@ -8,7 +8,7 @@ end
|
||||||
|
|
||||||
function change_locales()
|
function change_locales()
|
||||||
-- local localechange = { }
|
-- local localechange = { }
|
||||||
local localechange = { de = { "2xwr" } }
|
local localechange = { de = { "bLub" } }
|
||||||
|
|
||||||
for loc, flist in localechange do
|
for loc, flist in localechange do
|
||||||
for index, name in flist do
|
for index, name in flist do
|
||||||
|
|
Loading…
Reference in New Issue