unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
blob 6e488986c16a0d62c6f42309f7d9f44b3f3d8db7 1471 bytes (raw)
name: lib/symlink.c 	 # note: path name is non-authoritative(*)

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
 
/* Stub for symlink().
   Copyright (C) 2009-2021 Free Software Foundation, Inc.

   This file is free software: you can redistribute it and/or modify
   it under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 3 of the
   License, or (at your option) any later version.

   This file is distributed in the hope that it will be useful,
   but WITHOUT ANY WARRANTY; without even the implied warranty of
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   GNU Lesser General Public License for more details.

   You should have received a copy of the GNU Lesser General Public License
   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */

#include <config.h>

/* Specification.  */
#include <unistd.h>

#include <errno.h>
#include <string.h>
#include <sys/stat.h>


#if HAVE_SYMLINK

# undef symlink

/* Create a symlink, but reject trailing slash.  */
int
rpl_symlink (char const *contents, char const *name)
{
  size_t len = strlen (name);
  if (len && name[len - 1] == '/')
    {
      struct stat st;
      if (lstat (name, &st) == 0 || errno == EOVERFLOW)
        errno = EEXIST;
      return -1;
    }
  return symlink (contents, name);
}

#else /* !HAVE_SYMLINK */

/* The system does not support symlinks.  */
int
symlink (char const *contents _GL_UNUSED,
         char const *name _GL_UNUSED)
{
  errno = ENOSYS;
  return -1;
}

#endif /* !HAVE_SYMLINK */

debug log:

solving 6e488986c1 ...
found 6e488986c1 in https://yhetil.org/emacs-bugs/5d2f6394-2fc0-e20a-9018-0ea59f399ba2@cs.ucla.edu/ ||
	https://yhetil.org/emacs-bugs/d40c1fec-cf1a-6d4e-84b1-983e61d8aece@cs.ucla.edu/
found 2f6c0d484b in https://git.savannah.gnu.org/cgit/emacs.git
preparing index
index prepared:
100644 2f6c0d484b8327e4a873219eedf555932f77141b	lib/symlink.c

applying [1/1] https://yhetil.org/emacs-bugs/5d2f6394-2fc0-e20a-9018-0ea59f399ba2@cs.ucla.edu/
diff --git a/lib/symlink.c b/lib/symlink.c
index 2f6c0d484b..6e488986c1 100644

Checking patch lib/symlink.c...
Applied patch lib/symlink.c cleanly.

skipping https://yhetil.org/emacs-bugs/d40c1fec-cf1a-6d4e-84b1-983e61d8aece@cs.ucla.edu/ for 6e488986c1
index at:
100644 6e488986c16a0d62c6f42309f7d9f44b3f3d8db7	lib/symlink.c

(*) Git path names are given by the tree(s) the blob belongs to.
    Blobs themselves have no identifier aside from the hash of its contents.^

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).