D
Daniel Berger
Hi,
Windows XP Home
Ruby 1.8.6 p114
I think I need another set of eyes on this one, because it looks to me
like Ruby isn't picking up the changes I make with a custom umask, and
vice versa.
require 'win32/api'
include Win32
S_IWRITE = 0000200
S_IREAD = 0000400
Umask = API.new('_umask', 'I', 'I', 'msvcrt')
# Mimic file.c
def umask(*args)
omask = 0
if args.length == 0
omask = Umask.call(0)
Umask.call(omask)
elsif args.length == 1
omask = Umask.call(args[0])
else
raise ArgumentError, "wrong number of arguments"
end
return omask
end
p umask(S_IREAD) # 0
p umask # 256 (ok)
p umask # 256 (double check, ok)
p File.umask # 0 - wtf?
Why isn't Ruby's File.umask picking up the change? I see the same thing
if I set it with File.umask and try to read the changes with my own umask.
Regards,
Dan
Windows XP Home
Ruby 1.8.6 p114
I think I need another set of eyes on this one, because it looks to me
like Ruby isn't picking up the changes I make with a custom umask, and
vice versa.
require 'win32/api'
include Win32
S_IWRITE = 0000200
S_IREAD = 0000400
Umask = API.new('_umask', 'I', 'I', 'msvcrt')
# Mimic file.c
def umask(*args)
omask = 0
if args.length == 0
omask = Umask.call(0)
Umask.call(omask)
elsif args.length == 1
omask = Umask.call(args[0])
else
raise ArgumentError, "wrong number of arguments"
end
return omask
end
p umask(S_IREAD) # 0
p umask # 256 (ok)
p umask # 256 (double check, ok)
p File.umask # 0 - wtf?
Why isn't Ruby's File.umask picking up the change? I see the same thing
if I set it with File.umask and try to read the changes with my own umask.
Regards,
Dan