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

Function have_same_content

src/install.c:139–156  ·  view source on GitHub ↗

Compare content of opened files using file descriptors A_FD and B_FD. Return true if files are equal. */

Source from the content-addressed store, hash-verified

137/* Compare content of opened files using file descriptors A_FD and B_FD. Return
138 true if files are equal. */
139static bool
140have_same_content (int a_fd, int b_fd)
141{
142 enum { CMP_BLOCK_SIZE = 4096 };
143 static char a_buff[CMP_BLOCK_SIZE];
144 static char b_buff[CMP_BLOCK_SIZE];
145
146 idx_t size;
147 while (0 < (size = full_read (a_fd, a_buff, sizeof a_buff))) {
148 if (size != full_read (b_fd, b_buff, sizeof b_buff))
149 return false;
150
151 if (!memeq (a_buff, b_buff, size))
152 return false;
153 }
154
155 return size == 0;
156}
157
158/* Return true for mode with non-permission bits. */
159static bool

Callers 1

need_copyFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected