MCPcopy Create free account
hub / github.com/coreutils/coreutils / samedir_template

Function samedir_template

src/force-link.c:50–66  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 (setting errno) if unsuccessful. */
49
50static char *
51samedir_template (char const *dstname, char buf[smallsize])
52{
53 ptrdiff_t dstdirlen = last_component (dstname) - dstname;
54 size_t dsttmpsize = dstdirlen + sizeof simple_pattern;
55 char *dsttmp;
56 if (dsttmpsize <= smallsize)
57 dsttmp = buf;
58 else
59 {
60 dsttmp = malloc (dsttmpsize);
61 if (!dsttmp)
62 return dsttmp;
63 }
64 strcpy (mempcpy (dsttmp, dstname, dstdirlen), simple_pattern);
65 return dsttmp;
66}
67
68
69/* Auxiliaries for force_linkat. */

Callers 2

force_linkatFunction · 0.85
force_symlinkatFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected