mirror of
git://git.sv.gnu.org/emacs.git
synced 2025-12-05 22:20:24 -08:00
Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs into feature/pgtk
This commit is contained in:
commit
b64089c37b
182 changed files with 4996 additions and 1986 deletions
|
|
@ -251,7 +251,6 @@ get_current_dir_name (void)
|
|||
bufsize_max = min (bufsize_max, PATH_MAX);
|
||||
#endif
|
||||
|
||||
char *buf;
|
||||
struct stat dotstat, pwdstat;
|
||||
size_t pwdlen;
|
||||
/* If PWD is accurate, use it instead of calling getcwd. PWD is
|
||||
|
|
@ -265,37 +264,23 @@ get_current_dir_name (void)
|
|||
&& stat (".", &dotstat) == 0
|
||||
&& dotstat.st_ino == pwdstat.st_ino
|
||||
&& dotstat.st_dev == pwdstat.st_dev)
|
||||
{
|
||||
buf = xmalloc (strlen (pwd) + 1);
|
||||
strcpy (buf, pwd);
|
||||
}
|
||||
return strdup (pwd);
|
||||
else
|
||||
{
|
||||
size_t buf_size = 1024;
|
||||
ptrdiff_t buf_size = min (bufsize_max, 1024);
|
||||
for (;;)
|
||||
{
|
||||
int tmp_errno;
|
||||
buf = malloc (buf_size);
|
||||
if (! buf)
|
||||
break;
|
||||
if (getcwd (buf, buf_size) == buf)
|
||||
break;
|
||||
tmp_errno = errno;
|
||||
{
|
||||
char *buf = malloc (buf_size);
|
||||
if (!buf)
|
||||
return NULL;
|
||||
if (getcwd (buf, buf_size) == buf)
|
||||
return buf;
|
||||
free (buf);
|
||||
if (tmp_errno != ERANGE)
|
||||
{
|
||||
errno = tmp_errno;
|
||||
return NULL;
|
||||
}
|
||||
buf_size *= 2;
|
||||
if (! buf_size)
|
||||
{
|
||||
errno = ENOMEM;
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
if (errno != ERANGE || buf_size == bufsize_max)
|
||||
return NULL;
|
||||
buf_size = buf_size <= bufsize_max / 2 ? 2 * buf_size : bufsize_max;
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
|
|||
|
|
@ -1643,19 +1643,10 @@ process_file_name (char *file, language *lang)
|
|||
char *cmd = concat (cmd1, "' > ", tmp_name);
|
||||
#endif
|
||||
free (cmd1);
|
||||
int tmp_errno;
|
||||
if (system (cmd) == -1)
|
||||
{
|
||||
inf = NULL;
|
||||
tmp_errno = EINVAL;
|
||||
}
|
||||
else
|
||||
{
|
||||
inf = fopen (tmp_name, "r" FOPEN_BINARY);
|
||||
tmp_errno = errno;
|
||||
}
|
||||
inf = (system (cmd) == -1
|
||||
? NULL
|
||||
: fopen (tmp_name, "r" FOPEN_BINARY));
|
||||
free (cmd);
|
||||
errno = tmp_errno;
|
||||
}
|
||||
|
||||
if (!inf)
|
||||
|
|
@ -7068,9 +7059,7 @@ etags_mktmp (void)
|
|||
int fd = mkostemp (templt, O_CLOEXEC);
|
||||
if (fd < 0 || close (fd) != 0)
|
||||
{
|
||||
int temp_errno = errno;
|
||||
free (templt);
|
||||
errno = temp_errno;
|
||||
templt = NULL;
|
||||
}
|
||||
#if defined (DOS_NT)
|
||||
|
|
|
|||
|
|
@ -499,9 +499,9 @@ unlock_file (const char *filename, void *state)
|
|||
char *lockpath = (char *) state;
|
||||
int saved_errno = errno;
|
||||
int ret = unlink (lockpath);
|
||||
int unlink_errno = errno;
|
||||
if (0 <= ret)
|
||||
errno = saved_errno;
|
||||
free (lockpath);
|
||||
errno = ret < 0 ? unlink_errno : saved_errno;
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue