✅ Перевірена відповідь на це питання доступна нижче. Наші рішення, перевірені спільнотою, допомагають краще зрозуміти матеріал.
Consider the two programs given below to implement the command (ignore the fact that error checks are not done on return values of functions)
$ ls . /tmp/asdfksdf >/tmp/ddd 2>&1
Program 1
int main(int argc, char *argv[]) { int fd, n, i; char buf[128]; fd = open("/tmp/ddd", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); close(1); dup(fd); close(2); dup(fd); execl("/bin/ls", "/bin/ls", ".", "/tmp/asldjfaldfs", NULL);}
Program 2
int main(int argc, char *argv[]) { int fd, n, i; char buf[128]; close(1); fd = open("/tmp/ddd", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); close(2); fd = open("/tmp/ddd", O_WRONLY | O_CREAT, S_IRUSR | S_IWUSR); execl("/bin/ls", "/bin/ls", ".", "/tmp/asldjfaldfs", NULL);}Select all the correct statements about the programs
Отримайте необмежений доступ до відповідей на екзаменаційні питання - встановіть розширення Crowdly зараз!