andy-js commented on this pull request.


> +lzc_promote(const char *fsname, char *snapnamebuf, int snapnamelen)
+{
+       /*
+        * The promote ioctl is still legacy, so we need to construct our
+        * own zfs_cmd_t rather than using lzc_ioctl().
+        */
+       zfs_cmd_t zc = { 0 };
+
+       ASSERT3S(g_refcount, >, 0);
+       VERIFY3S(g_fd, !=, -1);
+
+       (void) strlcpy(zc.zc_name, fsname, sizeof (zc.zc_name));
+       if (ioctl(g_fd, ZFS_IOC_PROMOTE, &zc) != 0) {
+               if (errno == EEXIST && snapnamebuf != NULL)
+                       (void) strlcpy(snapnamebuf, zc.zc_string, snapnamelen);
+               return (errno);

To the best of my knowledge strlcpy does not set errno.  I looked at the source 
for it in libc and neither it, nor memcpy (which does the actual copy) set it.  
It should be safe.

-- 
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/openzfs/openzfs/pull/389#discussion_r119199155
------------------------------------------
openzfs-developer
Archives: 
https://openzfs.topicbox.com/groups/developer/discussions/T3d8522d1a7ad5f47-Meea79a6a9d7244f13434a178
Powered by Topicbox: https://topicbox.com

Reply via email to