@@ -802,10 +802,10 @@ extern "C" __attribute__ ((visibility("default"))) int sdc_fsetxattr(int fd, con
802802 }
803803 return r;
804804#endif
805- }
805+ }
806806
807- extern " C" __attribute__ ((visibility(" default" ))) int sdc_fs_flags_set (const char *path, unsigned long flags)
808- {
807+ extern " C" __attribute__ ((visibility(" default" ))) int sdc_fs_flags_set (const char *path, unsigned long flags)
808+ {
809809#if defined(__CYGWIN__) || defined(__HAIKU__)
810810 // TODO
811811 return 0 ;
@@ -842,7 +842,59 @@ extern "C" __attribute__ ((visibility("default"))) int sdc_fsetxattr(int fd, con
842842
843843 return r;
844844#endif
845- }
845+ }
846+
847+ extern " C" __attribute__ ((visibility(" default" ))) int sdc_mkfifo (const char *path, mode_t mode)
848+ {
849+ ClientReconstructCurDir crcd (path);
850+ int r = mkfifo (path, mode);
851+ if (r == 0 || !IsAccessDeniedErrno () || !TouchClientConnection (true )) {
852+ return r;
853+ }
854+
855+ try {
856+ ClientTransaction ct (SUDO_CMD_MKFIFO);
857+ ct.SendStr (path);
858+ ct.SendPOD (mode);
859+
860+ r = ct.RecvInt ();
861+ if (r != 0 )
862+ ct.RecvErrno ();
863+
864+ } catch (std::exception &e) {
865+ fprintf (stderr, " sudo_client: sdc_mkfifo('%s', 0x%lx) - error %s\n " ,
866+ path, (unsigned long )mode, e.what ());
867+ r = -1 ;
868+ }
869+
870+ return r;
871+ }
872+
873+ extern " C" __attribute__ ((visibility(" default" ))) int sdc_mknod (const char *path, mode_t mode, dev_t dev)
874+ {
875+ ClientReconstructCurDir crcd (path);
876+ int r = mknod (path, mode, dev);
877+ if (r == 0 || !IsAccessDeniedErrno () || !TouchClientConnection (true )) {
878+ return r;
879+ }
880+
881+ try {
882+ ClientTransaction ct (SUDO_CMD_MKNOD);
883+ ct.SendStr (path);
884+ ct.SendPOD (mode);
885+ ct.SendPOD (dev);
886+
887+ r = ct.RecvInt ();
888+ if (r != 0 )
889+ ct.RecvErrno ();
890+ } catch (std::exception &e) {
891+ fprintf (stderr, " sudo_client: sdc_mknod('%s', 0x%lx, 0x%lx) - error %s\n " ,
892+ path, (unsigned long )mode, (unsigned long )dev, e.what ());
893+ r = -1 ;
894+ }
895+
896+ return r;
897+ }
846898
847899
848900} // namespace Sudo
0 commit comments