[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] Changes to emacs/lib-src/update-game-score.c
From: |
Richard M. Stallman |
Subject: |
[Emacs-diffs] Changes to emacs/lib-src/update-game-score.c |
Date: |
Tue, 04 Feb 2003 07:03:47 -0500 |
Index: emacs/lib-src/update-game-score.c
diff -c emacs/lib-src/update-game-score.c:1.13
emacs/lib-src/update-game-score.c:1.14
*** emacs/lib-src/update-game-score.c:1.13 Tue Feb 4 07:00:09 2003
--- emacs/lib-src/update-game-score.c Tue Feb 4 07:03:44 2003
***************
*** 213,219 ****
if (strlen (newdata) > MAX_DATA_LEN)
newdata[MAX_DATA_LEN] = '\0';
! if ((user_id = get_user_id ()) == NULL)
lose_syserr ("Couldn't determine user id");
if (stat (scorefile, &buf) < 0)
--- 213,220 ----
if (strlen (newdata) > MAX_DATA_LEN)
newdata[MAX_DATA_LEN] = '\0';
! user_id = get_user_id ();
! if (user_id == NULL)
lose_syserr ("Couldn't determine user id");
if (stat (scorefile, &buf) < 0)
***************
*** 345,351 ****
return -1;
scorecount = 0;
cursize = 16;
! ret = malloc (sizeof (struct score_entry) * cursize);
if (!ret)
return -1;
while ((readval = read_score (f, &ret[scorecount])) == 0)
--- 346,352 ----
return -1;
scorecount = 0;
cursize = 16;
! ret = (struct score_entry *) malloc (sizeof (struct score_entry) * cursize);
if (!ret)
return -1;
while ((readval = read_score (f, &ret[scorecount])) == 0)
***************
*** 356,362 ****
scorecount++;
if (scorecount >= cursize)
{
! ret = realloc (ret, cursize *= 2);
if (!ret)
return -1;
}
--- 357,363 ----
scorecount++;
if (scorecount >= cursize)
{
! ret = (struct score_entry *) realloc (ret, cursize *= 2);
if (!ret)
return -1;
}
***************
*** 394,401 ****
char *newdata;
{
struct score_entry *newscores
! = realloc (*scores,
! sizeof (struct score_entry) * ((*count) + 1));
if (!newscores)
return -1;
newscores[*count].score = newscore;
--- 395,402 ----
char *newdata;
{
struct score_entry *newscores
! = (struct score_entry *) realloc (*scores,
! sizeof (struct score_entry) * ((*count) +
1));
if (!newscores)
return -1;
newscores[*count].score = newscore;
***************
*** 469,475 ****
if (stat (lockpath, &buf) == 0
&& (difftime (buf.st_ctime, time (NULL) > 60*60)))
unlink (lockpath);
! if ((fd = open (lockpath, O_CREAT | O_EXCL, 0600)) < 0)
{
if (errno == EEXIST)
{
--- 470,477 ----
if (stat (lockpath, &buf) == 0
&& (difftime (buf.st_ctime, time (NULL) > 60*60)))
unlink (lockpath);
! fd = open (lockpath, O_CREAT | O_EXCL, 0600);
! if (fd < 0)
{
if (errno == EEXIST)
{